|
Posted by Amer Neely on 11/12/06 23:32
Deniel Keplar wrote:
> after you succeed, post your reply, I want to know how also.
>
> Amer Neely wrote:
>> Hmmm. OK, so I will need to also walk through each of the new input
>> names, and check them with the 'empty' function. I'll work on that. Thanks.
>>
>
Will do.
In the mean time, here is the JS code I use to toggle checkboxes on or
off. You will have to edit to suit your situation. Specifically, this is
hard-coded to work on the first form on a page (forms[0]) so you would
change that to either a form name or specify which form you want to work
with.
function CheckAll(value) // toggles checkboxes on/off
{
for (i=0; i < document.forms[0].length; i++)
{
document.forms[0].elements[i].value);
if ( document.forms[0].elements[i].name =~ 'DeleteThis')
{
document.forms[0].elements[i].checked=value;
}
}
}
The function is called like this:
<a href="#" style="color:red; text-decoration:none"
onClick="CheckAll(1);return false;">Select All</a> • <a
style="color:red; text-decoration:none" href="#" onClick="CheckAll(0);
return false;">Unselect All<br /></a>
--
Amer Neely
w: www.softouch.on.ca/
b: www.softouch.on.ca/blog/
Perl | MySQL programming for all data entry forms.
"We make web sites work!"
[Back to original message]
|