灰色空间

导航

checkBox全选

<script  type="text/javascript">
   function SelectAllCheckboxes(spanChk)
   {
     var oItem=spanChk.children;
     var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.tiem[0];
     xState=theBox.checked;
     elm=theBox.form.elements;
     for(i=0;i<elm.length;i++)
     if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
     {
       if(elm[i].checked!=xState)
       elm[i].click();
     }
   }
</script>
<asp:CheckBox ID="CheckBox1" runat="server" type="checkbox" onclick="javascript:SelectAllCheckboxes(this);" />

posted on 2009-04-23 10:45  小桐  阅读(149)  评论(0编辑  收藏  举报