October 21st, 2012, 03:36 PM
Join Date: Oct 2012
Time spent in forums: 4 h 47 m 16 sec
Reputation Power: 0
Uncheck a checkbox if another checkbox is checked
I'm new to coding, but I'm getting through every problem I've encountered thanks to the people here and on other forums.
Now I'm wondering:
- I have to 2 different arrays of check boxes (150 boxes each)
- when a user clicks a card-shuffle button, it builds a deck based on the status of array #2
- checkbox #1 in array #1 corrosponds to checkbox #1 in array #2.
I need a statement that says " if checkbox #1 in array #1 ISN'T checked, then uncheck checkbox #1 in array #2."
And so on and so forth for the next checkboxes in the arrays.
Is this possible?
Here's what I've been trying: (maybe I'm accessing the form elements incorrectly? I don't get any errors from this code, but it doesn't work)
if (form.item_1_array_1.checked == true)
form.item_1_array_2.checked == true;
if (form.item_2_array_1.checked == true)
form.item_2_array_2.checked == true;
if (form.item_3_array_1.checked == true)
form.item_3_array_2.checked == true;
if (form.item_4_array_1.checked == true)
form.item_4_array_2.checked == true;
if (form.item_5_array_1.checked == true)
form.item_5_array_2.checked == true;
if (form.item_6_array_1.checked == true)
form.item_6_array_2.checked == true;
if (form.item_7_array_1.checked == true)
form.item_7_array_2.checked == true;
if (form.item_8_array_1.checked == true)
form.item_8_array_2.checked == true;