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

Javascript operation html control instance (javascript adds html)_Basic knowledge

WBOY
Release: 2016-05-16 17:11:13
Original
1141 people have browsed it

Copy code The code is as follows:

//Population of drop-down list

_showSchools: function (data) { //data represents a data object

          var mySelect = document.getElementById("selectSchools"); // Get the drop-down box for (var index in data) {
var item = data[index];
var opp = new Option(item.SchoolName, item.name); //The first parameter represents the content displayed in the drop-down box, and the second one represents The content selected in the drop-down box
opp.name = "option" index;
mySelect.add(opp);
},

//Getting the content of the drop-down list
var schoolId = document.getElementById("selectSchools").value;

//We usually select the value of the drop-down box to be the selected content, not the displayed content. How to get the displayed content? The following is to get the selected display content of the drop-down box

function on_idmbzd_change(){
var sel_obj=document.getElementById("idMbzd");

var index=sel_obj.selectedIndex;

alert(sel_obj.options[index].value);
alert(sel_obj.options[index] .text);
}

//Getting the content of the radio button
var chkObjs = document.getElementsByName("radio");
var checkvalue = null;

for (var i = 0; i < chkObjs. length; i ) {

                                                                                                                                                                                 
          }

//Radio button settings
if (entity.SelectType == 1) document.getElementById("SelectType").checked = true;
if (entity.SelectType == 0) document.getElementById ("UnSelectType").checked = true;

//Multiple check box settings

setCheckBox: function (data) {

var courseList = document.getElementsByName("CourseList");
for (var i = 0; i < courseList. length - 1; i ) {
                                                                                                                                                            }

},


Related labels:
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