Javascipt Checkbox Select All (Method 2)
Like I showed you on the other page, you can give a user the option to select (or deselect) all check boxes on a page. The different with this method is that it uses text links to select or deselect the check boxes based on what the user clicks.
<script type="text/javascript">
function checkAll(field,selectDeselect) {
if (selectDeselect == true) {
for (i = 0; i < field.length; i++) {
if (field[i].name == "Check"){
field[i].checked = true;
}
}
}
else {
for (i = 0; i < field.length; i++) {
if (field[i].name == "Check"){
field[i].checked = false;
}
}
}
}
</script>
To use this code, you will need text links on your page. Code for the links are as follows:
<form action="page-to-go-to.asp" method="post" name="FormName">
<a href="javascript:void(0);" onclick="javascript:checkAll(FormName,true);">Select All</a> <a href="javascript:void(0);" onclick="javascript:checkAll(FormName,false);">Deselect All</a>
<input type="checkbox" name="Check" id="Check1" value="1"> Checkbox #1
<input type="checkbox" name="Check" id="Check2" value="1"> Checkbox #2
<input type="checkbox" name="Check" id="Check3" value="1"> Checkbox #3
<input type="checkbox" name="Check" id="Check4" value="1"> Checkbox #4
</form>
To view a quick demo of this technique, click here 
NOTE: The form that you are using must have a name in order for this function to work. In this example, I used the name FormName but you can change this to anything that you want.
NOTE #2: In this example, I am checking the name of the check box in order to see if it should be checked. This allows you to make the function only check the boxes you want it to. If you want the function to check all check boxes on the page, you may remove the lines where it checks the name of the box.