Example 1 : A Single click for checking-unchecking multiple check boxes
 

<SCRIPT LANGUAGE = “JavaScript”>
<!–
 
function modify_boxes(to_be_checked,total_boxes){
  for ( i=0 ; i < total_boxes ; i++ ){
    if (to_be_checked){ 
  document.forms[0].chkboxarray[i].checked=true;
}
    else{
   
 document.forms[0].chkboxarray[i].checked=false;
    }
  }  
}
    
–>
</SCRIPT>


<BODY>
<FORM>
<INPUT TYPE=checkbox NAME=”chkboxarray” VALUE=”1″><br>
<INPUT TYPE=checkbox NAME=”chkboxarray” VALUE=”2″><br>
<INPUT TYPE=checkbox NAME=”chkboxarray” VALUE=”3″><br>
<INPUT TYPE=button NAME=”CheckAll” VALUE=”Check All Boxes” onClick=”modify_boxes(true,3)”>
<INPUT TYPE=button NAME=”UnCheckAll” VALUE=”UnCheck All Boxes” onClick=”modify_boxes(false,3)”>
</FORM>
</BODY> 

Example 2 : Opening a page (existing as well as dynamic) in a new window without bars, buttons, etc.

<SCRIPT LANGUAGE = “JavaScript”>
<!–

function open_new_window() {
  dlg = window.open (“newpage.html” ,”NewWindowName” , “width=400,height=400,
toolbar=no,location=no,directories=no,
status=no,menubar=no,scrollbars=no,resizable=no”) 
}

function open_new_window2() {
 
  dlg = window.open (“”,”NewWindowName2″,”width=400,height=400,toolbar=no,location=no,
directories=no,status=no,menubar=no,scrollbars=no,resizable=no”)
dlg.document.write (“<BODY bgColor=’#FFFFFF’>”)
dlg.document.write (“<CENTER>This is text that has been added on the fly using Javascript.</CENTER>”)
dlg.document.write (“</BODY>”) 
}
–>
</SCRIPT>

<BODY>
<A onClick=’open_new_window()’ >Click anywhere on this text to open the file newpage.html in a new window</a><br>

Or click on the button below to open a dynamically generated html page<br>

<FORM>
<INPUT type=”button” value=”New Window” onClick =’open_new_window2()’ >
</FORM>
</BODY>