HTML DOM Select 对象
Select 对象
Select 对象代表 HTML <select> 元素。
访问 Select 对象
您可以使用 getElementById() 访问 <select> 元素:
var x = document.getElementById("mySelect");
提示:您还可以通过遍历表单的 elements 集合来访问 Select 对象。
创建 Select 对象
您可以使用 document.createElement() 方法创建 <select> 元素:
var x = document.createElement("SELECT");
Select 对象集合
集合 | 描述 |
---|---|
options | 返回下拉列表中所有选项的集合。 |