cassie
12-22-2002, 02:39 PM
I want to use the Triple Combo Script By Hamid Cheheltani/ JavaScript Kit twice on my page.
I have changed the second form name to something else and the select name of the drop down box but still problems.
clicking the first box of the first (alpha) script populates the second box of the second (beta) script.
the beta script boxes work fine.
I know it is a problem with the event handler by looking at the tutorials but they are onload and I don't know enough to work this into these scripts.
I think the code is as follows - both are obviously the same at the moment
<FORM name="alpha">
<table border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td nowrap height="11">
<select name="example1" size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>---Select1-------------</option>
<option>list 1</option>
<option>list 2</option>
<option>list 3</option>
<option>list 4</option>
<option>list 5</option>
</select>
<select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected>---Select2--------------</option>
</select>
<select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected>---Select3----------------</option>
</select>
if you need the rest of the scipt let me know
Hope you can help - this is really bugging me.
Philip M
12-22-2002, 02:54 PM
You must alter the names of the select boxes stage1, stage2 and stage3 to make them unique. Likewise functions redirect, redirect1 and redirect2.
Skyzyx
12-22-2002, 02:56 PM
You might want to try going through the scripts and making sure that all of the variable names from script to script are different also. It sounds like if the beta script is working, but not the alpha, then the second script's variables are overwriting the first script's variables.
cassie
12-23-2002, 10:20 PM
Thanks for your replies so far - but I couldn't get that to work. I am posting the script below. Obviously there would be another one after it (on a different form) - which bits should I change in the second script?
Keep it simple please - relative newbie:o
<FORM name="isca">
<p> </p>
<table border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td nowrap height="11">
<select name="example1" size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>---Select1-------------</option>
<option>List 1</option>
<option>List 2</option>
<option>List 3</option></option>
</select>
<select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected>---Select2--------------</option>
</select>
<select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected>---Select3----------------</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.isca.example1.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("---Select2---"," ");
group[1][0]=new Option("Now Select This One"," ");
group[1][1]=new Option("List 1 Type A"," ");
group[1][2]=new Option("List 1 Type B"," ");
group[2][0]=new Option("Now Select This One"," ");
group[2][1]=new Option("List 2 Type A"," ");
group[2][2]=new Option("List 2 Type B"," ");
group[3][0]=new Option("Now Select This One"," ");
group[3][1]=new Option("List 3 Type A"," ");
group[3][2]=new Option("List 3 Type B"," ");
var temp=document.isca.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
redirect1(0)
}
var secondGroups=document.isca.stage2.options.length
var secondGroup=new Array(groups)
for (i=0; i<groups; i++) {
secondGroup[i]=new Array(group[i].length)
for (j=0; j<group[i].length; j++) {
secondGroup[i][j]=new Array() }}
secondGroup[0][0][0]=new Option("---Select 3---"," ");
secondGroup[1][0][0]=new Option("---Select 3---"," ");
secondGroup[1][1][0]=new Option("Now Select A Page"," ");
secondGroup[1][1][1]=new Option("List 1 Type A Number a","http://www.1Aa.htm");
secondGroup[1][1][2]=new Option("List 1 Type A Number b","http://www.1Ab.htm");
secondGroup[1][1][3]=new Option("List 1 Type A Number c","http://www.1Ac.htm");
secondGroup[1][2][0]=new Option("Now Select A Page"," ");
secondGroup[1][2][1]=new Option("List 1 Type B Number a","http://www.1Ba.htm");
secondGroup[1][2][2]=new Option("List 1 Type B Number b","http://www.1Bb.htm");
secondGroup[1][2][3]=new Option("List 1 Type B Number b","http://www.1Bc.htm");
secondGroup[2][0][0]=new Option("---Select 3---"," ");
secondGroup[2][1][0]=new Option("Now Select A Page"," ");
secondGroup[2][1][1]=new Option("List 2 Type A Number a","http://www.2Aa.htm");
secondGroup[2][1][2]=new Option("List 2 Type A Number b","http://www.2Ab.htm");
secondGroup[2][2][0]=new Option("Now Select A Page"," ");
secondGroup[2][2][1]=new Option("List 2 Type B Number a","http://www.2Ba.htm");
secondGroup[2][2][2]=new Option("List 2 Type B Number b","http://www.2Bb.htm");
secondGroup[3][0][0]=new Option("---Select 3---"," ");
secondGroup[3][1][0]=new Option("Now Select A Page"," ");
secondGroup[3][1][1]=new Option("List 3 Type A Number a","http://www.3Aa.htm");
secondGroup[3][1][2]=new Option("List 3 Type A Number b","http://www.3Ab.htm");
secondGroup[3][1][3]=new Option("List 3 Type A Number c","http://www.3Ac.htm");
secondGroup[3][1][4]=new Option("List 3 Type A Number d","http://www.3Ad.htm");
secondGroup[3][2][0]=new Option("Now Select A Page"," ");
secondGroup[3][2][1]=new Option("List 3 Type B Number a","http://www.3Ba.htm");
secondGroup[3][2][2]=new Option("List 3 Type B Number b","http://www.3Bb.htm");
var temp1=document.isca.stage3
function redirect1(y){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<secondGroup[document.isca.example1.options.selectedIndex][y].length;i++){
temp1.options[i]=new Option(secondGroup[document.isca.example1.options.selectedIndex][y][i].text,secondGroup[document.isca.example1.options.selectedIndex][y][i].value)
}
temp1.options[0].selected=true
}
function redirect2(z){
window.location=temp1[z].value
}
//-->
</script>
</td>
</tr>
</table>
</FORM>
Any help appreciated - Happy Holidays
cassie
01-06-2003, 05:23 PM
Happy New Year
I have been scratching my head all through the holidays on this one and still can't get it going.
philip m - what do i rename the stage names to - anything?
philip m - are the functions redirect, redirect1 etc able to be renamed? is so what to?
skyzyx - vhat are the 'variable names' in this scribt - remember i'm a newbie
Any help on above script will be most grateful.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.