HTMLOptionsCollection
HTMLOptionsCollection
接口表示 <option>
HTML 元素的集合(以文档的顺序),并提供从列表中选择以及可选地更改其项目的方法和属性。此对象仅由 select 的 options
属性返回。
实例属性
length
-
unsigned long
,正如规范所允许的那样,此属性不是只读的。你可以通过降低该值从末尾删除选项,或者提高该值在末尾添加空白选项。Mozilla 允许这样做,而其它实现可能会抛出 DOMException。
实例方法
从其父接口 HTMLCollection
继承方法。
规范
Specification |
---|
HTML # the-htmloptionscollection-interface |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
HTMLOptionsCollection | ||||||||||||
add | ||||||||||||
length | ||||||||||||
remove | ||||||||||||
selectedIndex |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.