DOM Option 对象

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
描述
IEFNW3C
defaultSelectedSets or returns the value of the selected attribute of the option
设置或是返回Optionselected属性的值
316Yes
disabledSets or returns a Boolean value that specifies whether the option should be disabled
设置或返回一个布耳值判断Option是否禁用
516Yes
formReturns a reference to the form that contains the option
返回包含Option表单的参考
316Yes
idSets or returns the id of the option (In IE 4 this property is read-only)
设置或返回Option的id(在IE4中这个属性为只读)
41 No
indexSets or returns the position of the option in the select box
设置或返回Option在select框中的位置
3  Yes
labelSets or returns a label for the option object
设置或返回Option对象的label
6  Yes
selectedSets or returns the current state of the option
设置或返回Option的当前状态(是否为选中)
316Yes
textSets or returns the text value for the <option> tag
设置或返回Option标签的文字值
316Yes
valueSets or returns the value to be returned to the server when an option is selected and the form is submitted
设置或返回当被选中的Option提交到服务器时它所包含的值
316Yes

Option 对象方法

Method
方法
Description
描述
IEFNW3C
click()Simulates a mouse-click on the option
模仿鼠标点击Option
4  No
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值