- <html>
- <head>
- <metahttp-equiv="Content-Type"content="text/html;charset=gb2312">
- <title>复选框全选、全不选和反选的效果实现</title>
- <SCRIPTLANGUAGE="JavaScript">
- <!--Begin
- functioncheckAll(){
- for(varj=1;j<=9;j++){
- box=eval("document.checkboxform.C"+j);
- if(box.checked==false)box.checked=true;
- }
- }
- functionuncheckAll(){
- for(varj=1;j<=9;j++){
- box=eval("document.checkboxform.C"+j);
- if(box.checked==true)box.checked=false;
- }
- }
- functionswitchAll(){
- for(varj=1;j<=9;j++){
- box=eval("document.checkboxform.C"+j);
- box.checked=!box.checked;
- }
- }
- //End-->
- </script>
- </head>
- <body>
- <formname=checkboxform>
- <inputtype=checkboxname=C1checked>C1<br>
- <inputtype=checkboxname=C2checked>C2<br>
- <inputtype=checkboxname=C3checked>C3<br>
- <inputtype=checkboxname=C4checked>C4<br>
- <inputtype=checkboxname=C5checked>C5<br>
- <inputtype=checkboxname=C6checked>C6<br>
- <inputtype=checkboxname=C7checked>C7<br>
- <inputtype=checkboxname=C8checked>C8<br>
- <inputtype=checkboxname=C9checked>C9<br>
- <br>
- <inputtype=buttonvalue="全部选中"onClick="checkAll()"><br>
- <inputtype=buttonvalue="全部不选"onClick="uncheckAll()"><br>
- <inputtype=buttonvalue="选择转换"onClick="switchAll()"><br>
- </form>
- </body>
- </html>
复选框全选、全不选和反选的效果实现VIEW:1592
最新推荐文章于 2020-07-30 16:15:58 发布