[Javascript] Checkbox Focus

David Hannum hannum at ohio.edu
Wed Jan 22 11:48:18 CST 2003


Peter,

Here's what I'm using to clear the "two group" method currently.
Because I'm using the form to do a dynamic query on the other end, I
need (want may be the case) the names to all be the same. That gives
me a nice, tight, comma delimited list on the other end to work with.

This code is not original. Someone helped me with it. Can a third
group be added?

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkChoice1(field, i) {
if (i == 0) { // "All" checkbox selected.
if (field[0].checked == true) {
for (i = 1; i < field.length; i++)
field[i].checked = false;
}
}
else { // A checkbox other than "Any" selected.
if (field[i].checked == true) {
field[0].checked = false;
}
}
}
// End -->
</SCRIPT>


----- Original Message -----
From: "Peter Brunone" <peter at brunone.com>
To: <javascript at LaTech.edu>
Sent: Wednesday, January 22, 2003 11:57 AM
Subject: Re: [Javascript] Checkbox Focus


Dave,

   I'm still a little confused.  Could you perhaps illustrate with some
source code so we have a starting point?

Cheers,

Peter

---------- Original Message ----------------------------------
From: "David Hannum" <hannum at ohio.edu>
Reply-To: javascript at LaTech.edu
Date: Wed, 22 Jan 2003 09:51:30 -0500

>Here's an interesting one.  I'm generating a list of checkboxes
dynamically.
>Now, the catcher is this.  While all of the checkboxes have the same name,
>they are divided into three groups.  The first group is one box which has
>the value equal to a comma delimited list of all the other checkbox values
>in the the first and second groups.  The second group is a separate
checkbox
>for each of the values found in the first group.  The third group is one
box
>with a comma delimited list of separate values.  Now, here is what I need.
>A)  If the user clicks the group one box, I need all boxes in groups two
and
>three to clear.
>B)  If the user clicks any box or boxes in group two, I need the group one
>box and the group three box to clear.
>C)  If the user clicks the group three box, I need all boxes in group one
>and two to clear.
>
>I have it working for group one and two.  But incorporating the third
option
>is out of my league.  Any help would be greatly appreciated.
>
>Kind Regards,
>Dave Hannum
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list