Home >Web Front-end >HTML Tutorial >Basic understanding and use of HTML select option_HTML/Xhtml_Web page production

Basic understanding and use of HTML select option_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:40:241597browse

Detailed explanation of HTML (select option) in javascript
1. Basic understanding:

Copy code
The code is as follows:

var e = document.getElementById("selectId");
e. options= new Option("text","value");
//Create An option object, that is, create one or more
//options is an array, which can store multiple tag value="value">Text Tags like this

1:options[ ]Attributes of array:
length attribute---------Length attribute
selectedIndex attribute--------The index value of the text in the currently selected box. This index value is automatically allocated by the memory (0,1,2,3...) corresponding to (No. One text value, second text value, third text value, fourth text value...)
2: Attributes of a single option (---obj.options[ obj.selecedIndex] is a specified