JS in the implementation of the check box is selected, all non-select and inverse, divided into two situations:
(1) Select "Please select" check box to complete the selection , do not select the "select" Before the check box to achieve the full selection
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">functionCheck_inter () {varInters = Document.getelementsbyname ("Inter"); for(vari=0;i<inters.length;i++){ if(document.getElementById ("Cbox"). checked==true) {inters[i].checked=true; }Else{inters[i].checked=false; } } }</script><body><input type= "checkbox" id= "Cbox" value= "" onclick= "Check_inter ()"/> Please select </br> <input type= "checkbox" Name= "Inter" value= "chess"/> Chess </br><input type= "checkbox" Name= "Inter" value= "game" /> Game </br><input type= "checkbox" Name= "Inter" value= "reading"/> Reading <br/></body>(2) Select all, select All, reverse select three buttons to achieve
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">//Select all, not select all functionCheckall (param) {varInters = Document.getelementsbyname ("Inter"); for(vari=0;i<inters.length;i++){ if(!param) {inters[i].checked=true; }Else{inters[i].checked=false; } } }//Inverse Selection functionuncheck () {varInters = Document.getelementsbyname ("Inter"); for(vari=0;i<inters.length;i++) {inters[i].checked= !inters[i].checked; } }</script><body><input type= "checkbox" Name= "Inter" value= "chess"/> Chess <br/><input type= " CheckBox "Name=" Inter "value=" game/> Game <br/><input type= "checkbox" Name= "Inter" value= "reading book"/> Reading <br/ ><input type= "button" onclick= "Checkall ()" value= "Select All"/><input type= "button" onclick= "Checkall (' un ')" Value= "Select All"/><input type= "button" onclick= "uncheck ()" value= "Reverse selection"/></body>JS implementation check box Select all, all do not select, reverse selection