当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > DOM Select 对象

HTML DOM
DOM TableRow 对象
DOM Textarea 对象
DOM Window 对象

HTML DOM 中的 DOM Select 对象


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 841 ::
收藏到网摘: n/a

Select 对象

The Select object represents a drop-down list in an HTML form. For each instance of an HTML <select> tag in a form, a Select object is created.
Select对象代表HTML表单中的下拉列表。每当表单中出现<select>标签就有Select对象被建立起来

You can access a Select object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
你可以从表单数组的数字或是名称来访问Select对象,或是使用getELmentById()来访问它

IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).

Select 对象集合

Collection
集合
Description
描述
IE  F N W3C
options[] Returns an array of all the options in a dropdown list
返回在下拉列表中所有可选项的数组
3 1 2 Yes

Select 对象属性

Property
属性
Description
描述
IE  F N W3C
accessKey Sets or returns the keyboard key to access the dropdown list
设置或获取下拉列表(select)对象的快捷键。
4     No
align Sets or returns the alignment of the dropdown list according to the surrounding text
设置或返回相对周围文字下拉列表的对齐方式
4     No
disabled Sets or returns whether or not the dropdown list should be disabled
设置或返回下拉列表是否为禁用
5 1 6 Yes
form Returns a reference to the dropdown list's parent form
设置或返回下拉列表的父表
3 1 2 Yes
id Sets or returns the id of the dropdown list (In IE 4 this property is read-only)
设置或返回下拉列表的id值(在IE4只这个属性为只读属性)
4 1   No
length Sets or returns the number of options in the dropdown list
设置或返回在下拉列表中可选项目的数量
3 1 2 Yes
multiple Sets or returns a Boolean value that indicates whether or not multiple items can be selected
设置或获取表明列表中是否可选中多个项目的 Boolean 值。
3 1 6 Yes
name Sets or returns the name of the dropdown list
设置或获取对象的名称。
3 1 2 Yes
selectedIndex Sets or returns the index of the selected option in the dropdown list
设置或获取选中选项位于 select 对象中的位置。
3 1 2 Yes
size Sets or returns the number of rows in the dropdown list
设置或获取列表中的行数。
3 1 6 Yes
tabIndex Sets or returns the tab order for the dropdown list
设置或获取定义对象的 Tab 顺序的索引。
5     Yes
type Returns the type of the form element. For a dropdown list it will be "select-one" or "select-multiple"
根据 MULTIPLE 属性的值获取 select 控件的类型。
4 1 3 Yes
value Sets or returns the value to be returned to the server when the form is submitted
设置或获取当表单控件提交时返回给服务器的值。
3 1 6 Yes

Select 对象方法

Method
方法
Description
描述
IE F N W3C
add() Adds an option to the dropdown list
向 下拉列表中添加一个选项。
4     Yes
blur() Removes focus from the dropdown list
从下拉列表中移除焦点
4 1 3 Yes
focus() Sets focus on the dropdown list
为下拉列表设置焦点
4 1 3 Yes
remove() Removes an option from the dropdown list
从下拉列表中删除可选项
4 1 6 Yes

Select 对象事件

Syntax: object.event_name="someJavaScriptCode"
语法:对象.事件名称="一些JS代码"

Event
事件
Description
描述
IE F N W3C
onBlur Executes some code when the dropdown list loses focus
当下拉列表失去焦点的时候执行一些代码
3 1 2  
onChange Executes some code when the dropdown list loses focus and its value has altered
当下拉列表失去焦点并且它的值发生变化的时候执行一些代码
3 1 2  
onClick Executes some code when the user clicks the left mouse button in the dropdown list
当用户点击了下拉列表执行一些代码
4      
onFocus Executes some code when the dropdown list gets focus
当下拉列表得到焦点执行一些代码
4 1 2  

评论 (0) All

登陆 | 还没注册?