Latest web development tutorials

HTML DOM Select Objects

Select Objects

Select HTML form object represents a drop-down list.

In the HTML form, <select> tag appears every time a Select object is created.

You can iterate through the form elements [] array to access a Select object, or use document.getElementById ().


Select a collection of objects

W3C: W3C standards.

集合 描述 W3C
options 返回包含下拉列表中的所有选项的一个数组。 Yes

Select Object Properties

属性 描述 W3C
disabled 设置或返回是否应禁用下拉列表。 Yes
form 返回对包含下拉列表的表单的引用。 Yes
length 返回下拉列表中的选项数目。 Yes
multiple 设置或返回是否选择多个项目。 Yes
name 设置或返回下拉列表的名称。 Yes
selectedIndex 设置或返回下拉列表中被选项目的索引号。 Yes
size 设置或返回下拉列表中的可见行数。 Yes
type 返回下拉列表的表单类型。 Yes

Select Object

方法 描述 W3C
add() 向下拉列表添加一个选项。 Yes
remove() 从下拉列表中删除一个选项。 Yes

Standard properties and events

Select the object also supports the standard attributes and events .