JavaScript

Hey you know when you are in hotmail or something, and you have a little
checkbox next to all your messages, there’s one at top you can check to
select or deselect them all? (i.e. put a check in all the boxes or remove
all the checks)

Do any of you have a prewritten JS code to do this?

Thanks in advance - trying to save all the time I can :slight_smile: Shena

Shena Delian O’Brien wrote:
>
> Hey you know when you are in hotmail or something, and you have a little
> checkbox next to all your messages, there’s one at top you can check to
> select or deselect them all? (i.e. put a check in all the boxes or
> remove all the checks)
>
> Do any of you have a prewritten JS code to do this?
>
> Thanks in advance - trying to save all the time I can Shena

Nevermind - found one:
http://javascript.internet.com/buttons/check-all.html#source

Shena Delian O’Brien wrote:
>
> Nevermind - found one:
> http://javascript.internet.com/buttons/check-all.html#source

What happens when your checkboxes have different names?

function checkall() { document.forms.FORMNAME.FIELDNAME-A.checked = true;
document.forms.FORMNAME.FIELDNAME-B.checked = true;
document.forms.FORMNAME.FIELDNAME-C.checked = true;
document.forms.FORMNAME.FIELDNAME-D.checked = true; // one line for each
element return(true); }

I know it’s not pretty or very powerful, but it works. In a dynamic
situation, I’d have to think about it for more than 30 seconds :slight_smile:

–Mike K.

Mike King wrote:
>
> Shena Delian O’Brien wrote:
> >
> > Nevermind - found one:
> > http://javascript.internet.com/buttons/check-all.html#source
>
> What happens when your checkboxes have different names?

I have php dynamically generate the javascript to spit out the fieldname-X
as many times as needed?

> I know it’s not pretty or very powerful, but it works. In a dynamic
> situation, I’d have to think about it for more than 30 seconds

Definitely dynamic :slight_smile:

I wanted something to work from, primarily. I hardly ever use code off the
net as-is.

Shena