标签:技术分享 input pre splay length alt single open elements
function chkall() { var obox = document.getElementById("chkAll"); console.log(obox.name); var odiv = document.getElementById("div"); console.log(odiv); var ach = odiv.getElementsByTagName("input"); console.log(ach); for (var i = 0; i < ach.length; i++) { ach[i].checked = obox.checked; } }
function chksingle() { var obox = document.getElementById("chkAll"); var odiv = document.getElementById("div"); var ach = odiv.getElementsByTagName("input"); for (var i = 0; i < ach.length; i++) { ach[i].onclick = function () { if (!this.checked) { obox.checked = false; } var flag = true; for (var i = 0; i < ach.length; i++) { if (!ach[i].checked) { flag = false; break; } } if (flag) { obox.checked = true; } }; } }
标签:技术分享 input pre splay length alt single open elements
原文地址:http://www.cnblogs.com/zjdbxdcxy/p/6698007.html