-1

看来我自己解决了这个问题~

以一种简单而愚蠢的方式:

复选框

var tab = document.getElementById("tbl"); 
var elems = tab.getElementsByTagName("input");
var len = elems.length;

for (var i = 0; i < len; i++) {
    if (tab.checked == elems.checked)
   {
        elems[i].checked = true;
   } 
}

取消选中所有框:

for (var i = 0; i < len; i++) {
    if (tab.checked == elems.checked)
   {
        elems[i].checked = false;
   } 
}
4

1 回答 1

0

看来我自己解决了这个问题~~

复选框

var tab = document.getElementById("tbl"); 
var elems = tab.getElementsByTagName("input");
var len = elems.length;

for (var i = 0; i < len; i++) {
    if (tab.checked == elems.checked)
   {
        elems[i].checked = true;
   } 
}

}

取消选中所有框:

for (var i = 0; i < len; i++) {
    if (tab.checked == elems.checked)
   {
        elems[i].checked = false;
   } 
}

}

于 2013-09-24T10:09:59.217 回答