Click to See Complete Forum and Search --> : selecting a group of check boxes


srikanthrl
09-19-2003, 12:53 AM
Can somebody help me by giving code for checking the group of check boxes by simply clicking select all(link).
thanks in advance



srikanth

Gollum
09-19-2003, 02:26 AM
It depends a lot on your checkboxes, but say for instance they all have the same name, then you could use this example:

<form name=f>
<input type=checkbox name=chkSA onclick="for(var i = 0; i < document.f.chkList.length; i++) document.f.chkList[i].checked = this.checked;">Select All<br>
<input type=checkbox name=chkList value=1 onclick="document.f.chkSA.checked = false;">First<br>
<input type=checkbox name=chkList value=2 onclick="document.f.chkSA.checked = false;">Second<br>
<input type=checkbox name=chkList value=3 onclick="document.f.chkSA.checked = false;">Third<br>
<input type=checkbox name=chkList value=4 onclick="document.f.chkSA.checked = false;">Fourth<br>
<input type=checkbox name=chkList value=5 onclick="document.f.chkSA.checked = false;">Fifth<br>
</form>

srikanthrl
09-19-2003, 04:50 AM
i am getting an error stating that
document.f.chkList is null or not an object. pl.. do the neccessary change and give

Gollum
09-19-2003, 05:02 AM
I don't know how, it works fine for me.

pyro
09-19-2003, 08:38 AM
Take a look at this thread: http://forums.webdeveloper.com/showthread.php?s=&threadid=17769