<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>Untitled Document</title><Script>window.onload=function(){ varOBTN1=document.getElementById ('BTN1'); varoBtn2=document.getElementById ('btn2'); varOBtn3=document.getElementById ('Btn3'); varOdiv=document.getElementById ('Div1'); varaCh=Odiv.getelementsbytagname ('input'); Obtn1.onclick=function(){ for(varI=0; I<Ach.length;i++) {ach[i].checked=true; } }; Obtn2.onclick=function(){ for(varI=0; I<Ach.length;i++) {ach[i].checked=false; } }; Obtn3.onclick=function(){ for(varI=0; I<Ach.length;i++){ if(ach[i].checked==true){//here with the = = Double equals signach[i].checked=false; } Else{ach[i].checked=true; } } };};</Script></Head><Body><inputID= "BTN1"type= "button"value= "Select All" /><inputID= "BTN2"type= "button"value= "Not selected" /><inputID= "Btn3"type= "button"value= "Reverse Selection" /><DivID= "Div1"> <inputtype= "checkbox" /><BR/> <inputtype= "checkbox" /><BR/> <inputtype= "checkbox" /><BR/> <inputtype= "checkbox" /><BR/> <inputtype= "checkbox" /><BR/> <inputtype= "checkbox" /><BR/></Div></Body></HTML>
JS Implementation Select all, uncheck, reverse selection example