Check All Boxes PDF Print E-mail
Written by Andrew Lechlak   
Saturday, 17 October 2009 06:23

Paste this code into an external JavaScript file named:checkAll.js

/* This script and many more are available free online at The JavaScript Source!! http://javascript.internet.com Created by: Nannette Thacker | http://www.shiningstar.net */ var checkflag = "false"; function check(field) { if (checkflag == "false") { for (i = 0; i < field.length; i++) { field[i].checked = true; } checkflag = "true"; return "Uncheck All"; } else { for (i = 0; i < field.length; i++) { field[i].checked = false; } checkflag = "false"; return "Check All"; } }



Paste this code into the HEAD section of your HTML document.

<script type="text/javascript" src="/joomla/checkAll.js"></script>



Paste this code into the BODY section of your HTML document

<form name=myform action="" method=post> <table> <tr><td> <strong>Make a selection</strong><br> <input type=checkbox name=list value="1">Java<br> <input type=checkbox name=list value="2">JavaScript<br> <input type=checkbox name=list value="3">ASP<br> <input type=checkbox name=list value="4">HTML<br> <input type=checkbox name=list value="5">SQL<br> <br> <input type=button value="Check All" onClick="this.value=check(this.form.list)"> </td></tr> </table> </form>


 

Add your comment

Your name:
Your email:
Your website:
Subject:
Comment: