[Javascript] select all checkboxes script
Michael Borchers
list at tridemail.de
Fri Feb 3 04:42:51 CST 2006
please note that the input has to look this way in my case:
<input type="checkbox" name="myName[1]" id="myName[1]" value="1">
<input type="checkbox" name="myName[2]" id="myName[2]" value="1">
...
and then a simple
<input type="button" onclick="CheckAll(formName, checkboxName)">
OR
<input type="button" onclick="CheckAll(checkboxName)">
to select or to deselect the checkboxes.
thanks!
----- Original Message -----
From: Michael Borchers
To: javascript at LaTech.edu
Sent: Friday, February 03, 2006 11:24 AM
Subject: [Javascript] select all checkboxes script
i need a little skript to check or uncheck all checkboxes on button click.
the form name and / or the checkbox name should be parsed dynamically to the function
function checkAll(formName, checkboxName)
i tried to modify this function:
function CheckAll()
{
if(document.form.ALL)
{
var c = document.form.ALL.checked;
}
for (var i=0;i<document.form.elements.length;i++)
{
var e = document.form.elements[i];
if(e.name != 'ALL')
{
if((e.checked!=c) && (e.type=="checkbox"))
{
e.click();
e.checked = c;
}
}
}
}
but how can i parse the forms name?
how about modifying the function without using a form name,
only using the checkboxes name?
thanks
------------------------------------------------------------------------------
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060203/e4fda5df/attachment.htm>
More information about the Javascript
mailing list