Home > Web Front-end > JS Tutorial > JavaScript control of select tag (option option/select)_javascript skills

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:42:30
Original
1259 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
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
Latest Issues
AngularJS Select default value?
From 1970-01-01 08:00:00
0
0
0
Select option using PHP loop
From 1970-01-01 08:00:00
0
0
0
Chrome doesn't apply padding to select options
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template