Mega Code Archive

 
Categories / JavaScript DHTML / Form Control
 

Check and uncheck a checkbox

<html> <head> <script type="text/javascript"> function check(){     var x=document.forms.myForm     x[0].checked=true } function uncheck(){     var x=document.forms.myForm     x[0].checked=false } </script> </head> <body> <form name="myForm">     <input type="checkbox" value="on">     <input type="button" onclick="check()" value="Check Checkbox">     <input type="button" onclick="uncheck()" value="Uncheck Checkbox"> </form> </body> </html>