Home > Web Front-end > JS Tutorial > body text

JavaScript control of select tag (option option/select)_javascript skills

WBOY
Release: 2016-05-16 17:42:30
Original
1218 people have browsed it

The select tag in html is also the asp:DropDownList control in asp.net.
Javascript's operations on them
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 Tags like this

1: options[ ] array attributes:
length attribute---------length attribute
selectedIndex Attributes--------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 (the first text value , the second text value, the third text value, the fourth text value...)
2: Attributes of a single option (---obj.options[obj.selecedIndex] It is a specified
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template