NewB
06-04-2003, 10:43 PM
Hello, I'm very much an amature at Java so I'll need a lot of hand-holding but here goes....
I've used the Cut and Paste version of the Double Combo from this site and changed it slightly to load into a frame as the original didn't.
So, the first pull down list I can now choose Strips 1-30, 30-60 etc (as it is on a cartoon/comic site) and in the following populated list, choose 1, 2, 3, 4...... etc.
Now, I've been told that it's all very nice, but a NEXT/PREVIOUS Button would be a good thing to add onto this as quite a lot of people can't be bothered to re-select an option from the second list.
So, what I need is for a selection to be made as normal, but two other buttons similar to the GO button can be used to move onto the 'next' or 'previous' selection (ie, program rather than actual user input) and re-populate the second list!!
I understand this is possible as I think this question has been asked before in more technical terms, and, as I said at the beginning I'm, a novice at all this and any cut and paste code would be much appreciated.
Hope you can help.
Cheers.
Paul.
The code so far is........
<form name="doublecombo">
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>Strips 1-30</option>
<option>Strips 31-60</option>
<option>Strips 61-90</option>
<option>Strips 91-120</option>
</select>
<select name="stage2" size="1">
<option value="AmoebaStrips/Strip0000.gif">Strip 1</option>
<option value="AmoebaStrips/Strip0001.gif">Strip 2</option>
etc...
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>
<script>
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("Strip 1","AmoebaStrips/Strip0000.gif")
group[0][1]=new Option("Strip 2","AmoebaStrips/Strip0001.gif")
etc...
group[1][0]=new Option("Strip 31","AmoebaStrips/Strip0030.gif")
group[1][1]=new Option("Strip 32","AmoebaStrips/Strip0031.gif")
etc...
group[2][0]=new Option("Strip 61","AmoebaStrips/Strip0059.gif")
group[2][1]=new Option("Strip 62","AmoebaStrips/Strip0060.gif")
etc...
group[3][0]=new Option("Strip 91","AmoebaStrips/Strip0089.gif")
etc...
var temp=document.doublecombo.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
}
function go(){
top.frames["mainFrame"].location=temp.options[temp.selectedIndex].value
}
//-->
</script>
</form>
I've used the Cut and Paste version of the Double Combo from this site and changed it slightly to load into a frame as the original didn't.
So, the first pull down list I can now choose Strips 1-30, 30-60 etc (as it is on a cartoon/comic site) and in the following populated list, choose 1, 2, 3, 4...... etc.
Now, I've been told that it's all very nice, but a NEXT/PREVIOUS Button would be a good thing to add onto this as quite a lot of people can't be bothered to re-select an option from the second list.
So, what I need is for a selection to be made as normal, but two other buttons similar to the GO button can be used to move onto the 'next' or 'previous' selection (ie, program rather than actual user input) and re-populate the second list!!
I understand this is possible as I think this question has been asked before in more technical terms, and, as I said at the beginning I'm, a novice at all this and any cut and paste code would be much appreciated.
Hope you can help.
Cheers.
Paul.
The code so far is........
<form name="doublecombo">
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>Strips 1-30</option>
<option>Strips 31-60</option>
<option>Strips 61-90</option>
<option>Strips 91-120</option>
</select>
<select name="stage2" size="1">
<option value="AmoebaStrips/Strip0000.gif">Strip 1</option>
<option value="AmoebaStrips/Strip0001.gif">Strip 2</option>
etc...
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>
<script>
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("Strip 1","AmoebaStrips/Strip0000.gif")
group[0][1]=new Option("Strip 2","AmoebaStrips/Strip0001.gif")
etc...
group[1][0]=new Option("Strip 31","AmoebaStrips/Strip0030.gif")
group[1][1]=new Option("Strip 32","AmoebaStrips/Strip0031.gif")
etc...
group[2][0]=new Option("Strip 61","AmoebaStrips/Strip0059.gif")
group[2][1]=new Option("Strip 62","AmoebaStrips/Strip0060.gif")
etc...
group[3][0]=new Option("Strip 91","AmoebaStrips/Strip0089.gif")
etc...
var temp=document.doublecombo.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
}
function go(){
top.frames["mainFrame"].location=temp.options[temp.selectedIndex].value
}
//-->
</script>
</form>