Nihilists
07-25-2003, 02:33 PM
With using the below script. How can I make the select name a variable on stage 2 and 3 that is based on the first selection.
otherwords...
So choice 1 would change the select name of both option 1 and 2 <choice1><option1><option2>
That way depending on what is first selected the form would submit different select names to a shopping cart. Its already set up to populate the option1 and option2 based off what is selected in choice1
<select name="variable" size="1" onChange="redirect1(this.options.selectedIndex)">
Thankyou
<body>
<FORM name="isc">
<table border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td nowrap height="11">
<select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>Choose Wisely</option>
<option>Choice 1</option>
<option>Choice 2</option>
</select>
<select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>Extra Options if Available</option>
<option value=" " selected>Extra Options if Available</option>
</select>
<select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>Extra Options if Available</option>
<option value=" " selected>Extra Options if Available</option>
</select>
<script>
<!--
/*
Triple Combo Script Credit
By Hamid Cheheltani/ JavaScript Kit (http://www.javascriptkit.com)
Visit http://javascriptkit.com for this and over 400+ other scripts
*/
var groups=document.isc.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("Extra Option if Available"," ");
group[1][0]=new Option("Menu 1"," ");
group[1][1]=new Option("Bronze","47");
group[1][2]=new Option("Silver","46");
group[1][3]=new Option("Gold","45");
group[2][0]=new Option("Menu 1A"," ");
group[2][1]=new Option("Some News","115");
group[2][2]=new Option("Broken Technology","116");
var groups2=document.isc.example.options.length
var group2=new Array(groups2)
for (i=0; i<groups2; i++)
group2[i]=new Array()
group2[0][0]=new Option("Extra Option if Available"," ");
group2[1][0]=new Option("Menu 2"," ");
group2[1][1]=new Option("Red","47");
group2[1][2]=new Option("Black","46");
group2[1][3]=new Option("White","45");
group2[2][0]=new Option("Menu 2B"," ");
group2[2][1]=new Option("General News","115");
group2[2][2]=new Option("Technology News","116");
var temp=document.isc.stage2
var temp1=document.isc.stage3
function redirect(x){
for (m=temp.options.length-1;m>0;m--){
temp.options[m]=null
}
for (m=temp1.options.length-1;m>0;m--){
temp1.options[m]=null
}
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
for (i=0;i<group2[x].length;i++){
temp1.options[i]=new Option(group2[x][i].text,group2[x][i].value)
}
}
</script>
</td>
</tr>
</table>
</FORM>
<p><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
Kit</a></font></p>
</body>
otherwords...
So choice 1 would change the select name of both option 1 and 2 <choice1><option1><option2>
That way depending on what is first selected the form would submit different select names to a shopping cart. Its already set up to populate the option1 and option2 based off what is selected in choice1
<select name="variable" size="1" onChange="redirect1(this.options.selectedIndex)">
Thankyou
<body>
<FORM name="isc">
<table border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td nowrap height="11">
<select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>Choose Wisely</option>
<option>Choice 1</option>
<option>Choice 2</option>
</select>
<select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>Extra Options if Available</option>
<option value=" " selected>Extra Options if Available</option>
</select>
<select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>Extra Options if Available</option>
<option value=" " selected>Extra Options if Available</option>
</select>
<script>
<!--
/*
Triple Combo Script Credit
By Hamid Cheheltani/ JavaScript Kit (http://www.javascriptkit.com)
Visit http://javascriptkit.com for this and over 400+ other scripts
*/
var groups=document.isc.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("Extra Option if Available"," ");
group[1][0]=new Option("Menu 1"," ");
group[1][1]=new Option("Bronze","47");
group[1][2]=new Option("Silver","46");
group[1][3]=new Option("Gold","45");
group[2][0]=new Option("Menu 1A"," ");
group[2][1]=new Option("Some News","115");
group[2][2]=new Option("Broken Technology","116");
var groups2=document.isc.example.options.length
var group2=new Array(groups2)
for (i=0; i<groups2; i++)
group2[i]=new Array()
group2[0][0]=new Option("Extra Option if Available"," ");
group2[1][0]=new Option("Menu 2"," ");
group2[1][1]=new Option("Red","47");
group2[1][2]=new Option("Black","46");
group2[1][3]=new Option("White","45");
group2[2][0]=new Option("Menu 2B"," ");
group2[2][1]=new Option("General News","115");
group2[2][2]=new Option("Technology News","116");
var temp=document.isc.stage2
var temp1=document.isc.stage3
function redirect(x){
for (m=temp.options.length-1;m>0;m--){
temp.options[m]=null
}
for (m=temp1.options.length-1;m>0;m--){
temp1.options[m]=null
}
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
for (i=0;i<group2[x].length;i++){
temp1.options[i]=new Option(group2[x][i].text,group2[x][i].value)
}
}
</script>
</td>
</tr>
</table>
</FORM>
<p><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
Kit</a></font></p>
</body>