全选

来源:互联网 发布:手机日志软件 编辑:程序博客网 时间:2024/04/28 01:58
 ///全选或取消全选方法
function selectAll(box){
 var boxList = document.getElementsByTagName("input");
 if(box.checked){
 var i = 0;
  for(;i<boxList.length;i++){
   if(boxList[i].type=="checkbox" && boxList[i].id != "selectAll"){
    boxList[i].checked="checked";
    checkBoxCollector(boxList[i]);
   }
  }
 }else{
  var i=0;
  for(;i<boxList.length;i++){
   if(boxList[i].type=="checkbox" && boxList[i].id != "selectAll"){
    boxList[i].checked = null;
    checkBoxCollector(boxList[i]);
   }
  }
 }
}