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

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

HTML DOM 中的 DOM Option 对象


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

Option 对象

The Option object represents a selectable option in a drop-down list in an HTML form. For each instance of an <option> tag in an HTML form, an Option object is created.
Option对象代表HTML表单中的可选项。HTML表单中只要出现<option>标签就有Option对象被建立

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

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

Option 对象属性

Property
属性
Description
描述
IE F N W3C
defaultSelected Sets or returns the value of the selected attribute of the option
设置或是返回Optionselected属性的值
3 1 6 Yes
disabled Sets or returns a Boolean value that specifies whether the option should be disabled
设置或返回一个布耳值判断Option是否禁用
5 1 6 Yes
form Returns a reference to the form that contains the option
返回包含Option表单的参考
3 1 6 Yes
id Sets or returns the id of the option (In IE 4 this property is read-only)
设置或返回Option的id(在IE4中这个属性为只读)
4 1   No
index Sets or returns the position of the option in the select box
设置或返回Option在select框中的位置
3     Yes
label Sets or returns a label for the option object
设置或返回Option对象的label
6     Yes
selected Sets or returns the current state of the option
设置或返回Option的当前状态(是否为选中)
3 1 6 Yes
text Sets or returns the text value for the <option> tag
设置或返回Option标签的文字值
3 1 6 Yes
value Sets or returns the value to be returned to the server when an option is selected and the form is submitted
设置或返回当被选中的Option提交到服务器时它所包含的值
3 1 6 Yes

Option 对象方法

Method
方法
Description
描述
IE F N W3C
click() Simulates a mouse-click on the option
模仿鼠标点击Option
4     No

评论 (0) All

登陆 | 还没注册?