实现全选与反选

来源:互联网 发布:unity3d ui 高科技 编辑:程序博客网 时间:2024/05/01 09:21

 function SelectAll(tempControl)
       {
            var theBox=tempControl;
             xState=theBox.checked; 
            elem=theBox.form.elements;
            for(i=0;i<elem.length;i++)
            if(elem[i].type=="checkbox" && elem[i].id!=theBox.id)
             {
                  if(elem[i].checked!=xState)
                        elem[i].click();
            }
     } 

 

javascript:SelectAll(this)() 

原创粉丝点击