1 //复选框全选 2 var oCheckBox ={ 3 _check_all: function(obj){ 4 if("all" == obj.name){ 5 if(obj.checked){ 6 $("#days input:checkbox").each(function(){ 7 this.checked = true; 8 }); 9 }else{ 10 $("#days input:checkbox").each(function(){ 11 this.checked = false; 12 }); 13 } 14 }else{ 15 var oAll = document.getElementById("checkall"); 16 if(obj.checked){ 17 var allDays = document.getElementById("days").childNodes; 18 for (var i=0; i < allDays.length; i++) 19 { 20 if((allDays[i].type == "checkbox") && !allDays[i].checked){ 21 oAll.checked = false; 22 return; 23 } 24 } 25 oAll.checked = true; 26 }else{ 27 oAll.checked = false; 28 } 29 } 30 }, 31 _init_checkbox:function(){ 32 $("#days input:checkbox").each(function(){ 33 $(this).attr("checked", false); 34 }); 35 $("#checkall").attr("checked", false); 36 } 37 }