AndyL
05-21-2003, 05:35 PM
Hello,
I have 2 drop-down menus on a web-page. I want the user to choose a value from drop-down menu #1, then a value from drop-down menu #2, press a 'Submit' button and then it will do something. The resulting action needs to be dependent on both drop-down menu selections. I am fairly happy that my 2 <FORM>s are correct but am unsure what function (under "onClick") I should be calling to capture both the drop-down menu selections, and what the contents of the actual funtion need to be .... ?
So far I have the following code:
function check (checkReasonSelection)
{
for (var i=0; i<checkReasonSelection.reasonForm.reasonLinks.length; i++)
{
if (checkReasonSelection.reasonForm.reasonLinks.options[i].value)
{
var reason=checkReasonSelection.reasonForm.reasonLinks.options[i].value;
if (reason=="all cards")
{
alert ("yippeee!");
}
break;
}
}
}
<FORM name="reasonForm">
<SELECT name="reasonLinks">
<OPTION SELECTED value="all cards">All Cards</OPTION>
<OPTION value="birthday">Birthday</OPTION>
<OPTION value="christmas">Christmas</OPTION>
<OPTION value="easter">Easter</OPTION>
</SELECT>
<INPUT type="button" name="step3" value="Step 3..." onClick="window.location=document.reasonForm.reasonLinks.options[document.reasonForm.reasonLinks.selectedIndex].value">
</FORM>
<FORM name="typeForm">
<SELECT name="typeLinks">
<OPTION SELECTED value="all cards">All Cards</OPTION>
<OPTION value="humorous">Humorous</OPTION>
<OPTION value="modern art">Modern Art</OPTION>
<OPTION value="traditional">Traditional</OPTION>
<OPTION value="rude">Rude</OPTION>
<INPUT type="button" name="step3" value="Step 3..." onClick="window.location=document.typeForm.typeLinks.options[document.typeForm.typeLinks.selectedIndex].value">
</FORM>
Many thanks for any helpful suggestions,
Andy
I have 2 drop-down menus on a web-page. I want the user to choose a value from drop-down menu #1, then a value from drop-down menu #2, press a 'Submit' button and then it will do something. The resulting action needs to be dependent on both drop-down menu selections. I am fairly happy that my 2 <FORM>s are correct but am unsure what function (under "onClick") I should be calling to capture both the drop-down menu selections, and what the contents of the actual funtion need to be .... ?
So far I have the following code:
function check (checkReasonSelection)
{
for (var i=0; i<checkReasonSelection.reasonForm.reasonLinks.length; i++)
{
if (checkReasonSelection.reasonForm.reasonLinks.options[i].value)
{
var reason=checkReasonSelection.reasonForm.reasonLinks.options[i].value;
if (reason=="all cards")
{
alert ("yippeee!");
}
break;
}
}
}
<FORM name="reasonForm">
<SELECT name="reasonLinks">
<OPTION SELECTED value="all cards">All Cards</OPTION>
<OPTION value="birthday">Birthday</OPTION>
<OPTION value="christmas">Christmas</OPTION>
<OPTION value="easter">Easter</OPTION>
</SELECT>
<INPUT type="button" name="step3" value="Step 3..." onClick="window.location=document.reasonForm.reasonLinks.options[document.reasonForm.reasonLinks.selectedIndex].value">
</FORM>
<FORM name="typeForm">
<SELECT name="typeLinks">
<OPTION SELECTED value="all cards">All Cards</OPTION>
<OPTION value="humorous">Humorous</OPTION>
<OPTION value="modern art">Modern Art</OPTION>
<OPTION value="traditional">Traditional</OPTION>
<OPTION value="rude">Rude</OPTION>
<INPUT type="button" name="step3" value="Step 3..." onClick="window.location=document.typeForm.typeLinks.options[document.typeForm.typeLinks.selectedIndex].value">
</FORM>
Many thanks for any helpful suggestions,
Andy