网络学院 w3pop社区 网络资源 IT新闻

w3pop.com :: 网络学院 :: HTML :: HTML <select>标签

会员登陆

帐号

密码

回答

记住密码

忘记密码? 注册

HTML <select>标签


作者:w3pop.com 翻译/整理:w3pop.com 发布:2007-04-28 浏览:4207 :: ::

定义与用法

The select element creates a drop-down list.
select元素可建立下拉列表


在HTML和XHTML中的区别

NONE


提示与注意点

Tip: Use this tag in the form element to accept user input.
提示:可以在form元素中使用这个标签,用来接受用户的输入信息。


实例

代码 输出
<select>
  <option value ="volvo">Volvo</option>
  <option value ="saab">Saab</option>
  <option value ="opel">Opel</option>
  <option value ="audi">Audi</option>
</select>


可选属性

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
下表中的DTD列指明了被支持的DTD属性。S=Strict(精确的),T=Transitional(传统的),F=Frameset(框架)

属性 描述 DTD
disabled disabled When set, it disables the drop-down list
设置后下拉列表就不可用了
STF
multiple multiple When set, it specifies that multiple items can be selected at a time
设置后就可以进行多项选择
STF
name unique_name Defines a unique name for the drop-down list
为下拉列表定义唯一的name
STF
size number Defines the number of visible items in the drop-down list
定义下拉列表可见选项的个数
STF

标准属性

id, class, title, style, dir, lang, xml:lang, accesskey, tabindex

For a full description, go to Standard Attributes.
查看完整的属性

事件属性

onfocus, onblur, onchange

For a full description, go to Event Attributes.
查看完整的属性


尝试与演示

Simple drop down box
How to create a simple drop-down box on an HTML page. A drop-down box is a selectable list.
在HTML中建立简单的下拉列表框。

Another drop down box
How to create a simple drop-down box with a pre-selected value.
建立一个已经预选了值的下拉列表框

评论 (0) All