Tryit Editor v1.4

<html> <head> <script type="text/javascript"> function makeCheck(thisForm) { for (i = 0; i < thisForm.option.length; i++) { thisForm.option[i].checked=true; } } function makeUncheck(thisForm) { for (i = 0; i < thisForm.option.length; i++) { thisForm.option[i].checked=false; } } </script> </head> <body> <form name="myForm"> <input type="button" value="Check" onclick="makeCheck(this.form)"> <input type="button" value="Uncheck" onclick="makeUncheck(this.form)"> <br /> <input type="checkbox" name="option">Apples<br /> <input type="checkbox" name="option">Oranges<br /> <input type="checkbox" name="option">Bananas<br /> <input type="checkbox" name="option">Melons </form> </body> </html> | Your Result:
Edit the code above and click to see the result. | W3Schools.com - Try it yourself