Copy the code code 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
mySelect.options.length = 0;
//Add option to the select tag
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 parameter represents the content selected in the drop-down box
opp.name = "option" + index;
mySelect.add(opp);
}
},
//Get the contents 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);
}
//Get the content of the radio button
var chkObjs = document.getElementsByName("radio");
var checkvalue = null;
for (var i = 0; i < chkObjs.length; i++) {
if (chkObjs[i].checked) {
checkvalue = parseInt(chkObjs[i].value);
}
}
//Settings for radio buttons
if (entity.SelectType == 1) document.getElementById("SelectType").checked = true;
if (entity.SelectType == 0) document.getElementById("UnSelectType").checked = true;
//Settings for multi-select boxes
setCheckBox: function (data) {
var courseList = document.getElementsByName("CourseList");
for (var i = 0; i < courseList.length - 1; i++) {
if (courseList[i].value==data) {
courseList[i].checked=true;
}
}
},