Javascript manipulation HTML control instance of javascript to add HTML
- 2020-03-30 00:42:47
- OfStack
//The padding of the drop-down list
_showSchools: function (data) { //Data represents a data object
var mySelect = document.getElementById("selectSchools"); //Gets the drop-down box
mySelect.options.length = 0;
//Add option to the select TAB
for (var index in data) {
var item = data[index];
var opp = new Option(item.SchoolName, item.name); //The first parameter represents what the drop-down box shows, and the second represents what the drop-down box selects
opp.name = "option" + index;
mySelect.add(opp);
}
},
//The retrieval of the contents of the drop-down list
var schoolId = document.getElementById("selectSchools").value;
// We usually select the value of the drop-down box is the selected content, not the displayed content, how to get the displayed content, the following is Gets the drop-down box The selected display content of
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);
}
//The retrieval of the contents of a 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);
}
}
//Radio button Settings
if (entity.SelectType == 1) document.getElementById("SelectType").checked = true;
if (entity.SelectType == 0) document.getElementById("UnSelectType").checked = true;
//Multi-marquee Settings
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;
}
}
},