javascript操作によくあるhtmlタグ
4480 ワード
HTML HTML , select, input, div, table 。html , 。 ajax+json 。 javascript HTML , 。
//
_showSchools: function (data) { //data var mySelect = document.getElementById("selectSchools"); //
mySelect.options.length = 0;
// option select
for (var index in data) {
var item = data[index];
var opp = new Option(item.SchoolName, item.name); // ,
opp.name = "option" + index;
mySelect.add(opp);
}
},
//
var schoolId = document.getElementById("selectSchools").value;
// , , ,
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);
}
//
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);
}
}
//
if (entity.SelectType == 1) document.getElementById("SelectType").checked = true;
if (entity.SelectType == 0) document.getElementById("UnSelectType").checked = true;
//
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;
}
}
},