select object
A <select> tag corresponds to a select object.
select object properties
options[]: Set or return the <option> tag in the drop-down list array.
selectedIndex: Set or select the index number of the specified <option>.
length: Specify the number of <option> tags in the drop-down list.
name: element name.
option object
An <option> tag corresponds to an option object.
option object attribute
text: refers to the text between <option> and </option> .
value: refers to the attribute of the <option> tag.
<!DOCTYPE HTML> <html> <head> <meta charset="utf-8" /> <title>php.cn</title> <script> window.onload=function(){ var Form = document.form; Form.city.options[2].text = "合肥"; alert(Form.city.options[2].text); } </script> </head> <body> <form name="form" method="post" action=""> 城市: <select name="city"> <option value="0">北京</option> <option value="1">上海</option> <option value="2">深圳</option> </select> </form> </body> </html>