Copy codeThe Code is as follows:
<Select name = "aaa" SIZE = "" style = "width: 200px">
<Option value = ""> (null) </OPTION>
<Option value = "1"> 1 </OPTION>
</SELECT>
Copy codeThe Code is as follows:
// Obtain the html Control
Var select = document. getElementsByName ("aaa") [0];
Select. selectedIndex = index;
// Create a new Option object
New Option (text, value)
New option (text, value, defaultSelected, selected
Text: String, specifying the text attribute of the option object (that is, text between <option> </option>)
Value: a string that specifies the value Attribute of the option object.
DefaultSelected: Boolean value, which specifies the defaultSelected attribute of the option object.
Selected: Boolean value, specifying the selected Attribute of the option object
// Add Option to select
Select. add (new Option (text, value ))
// Delete
Select. options. remove (index)
// Delete all at once
Select. length = 0;