hey everyone,
i've been trying to solve this problem for 2 days straight, with no end in sight. i would greatly appreciate anyone's help.
EXPLANATION: There are 3 Select Menus. The 1st and 2nd Select Menu are "printing options" for 4x6 and 5x7 prints respectively. the 3rd Select Menu holds an "Email" option that can be toggled (appear/reappear) by the 1st and 2nd Select Menus. So if a user selects prints from either 4x6 or 5x7 menu, the "Email" option should disappear so the user can't select it (after all, you can't really email prints right?). The goal is that if there are any 4x6 or 5x7 prints selected (separately or simultaneously), the "Email" option will not be available.
THE PROBLEM: both 4x6 and 5x7 Select Menus work separately, but getting them to work together is the trouble. for example: if you choose any 4x6 prints, the "Email" option disappears, then if you select "4x6 File (With Email Option!)", the "Email" option will reappear. the same goes for the 5x7 Select Menu if it is uses seperatly.
however, if at first a user wants to have 4x6 and 5x7 prints done, the "Email" option disappears. but if the user changes his/her mind about the 5x7 prints, and changes that select menu back to "5x7 File (With Email Option)" while the 4x6 Select Menu is still selecting a print, the "Email" option will reappear! again, the goal is to have the "Email" option unavailable if either of the Select Menus have any prints selected.
[HTML]
<HTML>
<HEAD>
<SCRIPT LANGUAGE=JavaScript>
function ToggleEmail4x6 (val)
{
if(val=="4x6_0")
{AddEmailToReceving()}
else {RemoveEmailFromReceving()}
}
function ToggleEmail5x7 (val)
{
if(val=="5x7_0")
{AddEmailToReceving()}
else {RemoveEmailFromReceving()}
}
function RemoveEmailFromReceving()
{
if (document.IMAGEForm.recevingoptions.options[2].text == "Email")
{document.IMAGEForm.recevingoptions.options[2] = null;}
}
function AddEmailToReceving()
{
if (document.IMAGEForm.recevingoptions.options[2].text != "Email")
{
var indexCounter;
var recevingchoice = document.IMAGEForm.recevingoptions;
var lastoption = new Option();
recevingchoice.options[3] = lastoption;
for (indexCounter = 3;indexCounter > 2; indexCounter--)
{
recevingchoice.options[indexCounter].text = recevingchoice.options[indexCounter - 1].text;
recevingchoice.options[indexCounter].value = recevingchoice.options[indexCounter - 1].value;
}
var option = new Option("Email",2);
recevingchoice.options[2] = option;
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME=IMAGEForm>
<p><BR><label></label>
A) Please Select Prints </p>
<p>
<label>
<select name=4x6printoptions onChange="ToggleEmail4x6(this.value)">
<option value="4x6_0">4x6 File (With Email Option!)</option>
<option value="4x6_1">One 4x6 Print</option>
<option value="4x6_2">Two 4x6 Prints</option>
<option value="4x6_3">Three 4x6 Prints</option>
</select>
</label>
</p>
<p>
<label>
<select name=5x7printoptions onChange="ToggleEmail5x7(this.value)">
<option value="5x7_0">5x7 File (With Email Option!)</option>
<option value="5x7_1">One 5x7 Print</option>
<option value="5x7_2">Two 5x7 Prints</option>
<option value="5x7_3">Three 5x7 Prints</option>
</select>
</label>
</p>
<p> </p>
<p>B) Please Select your Receving Choice:<BR>
<select name=recevingoptions size="4">
<option value="0">
<option value="1">Courier
<option value="2">Email
<option value="3">Local Pick-Up
</select>
</p>
</FORM>
</BODY>
</HTML>
[/HTML]
Edited by iam_clint: Please wrap your code in [ code] or [ html] tags. I did it for you this time.
Thanks for anyone's help!