Dobbelt drop down
Hej med jer.Jeg vil gerne benytte nedenstående script, men jeg vil gerne have, at scriptet fungerer uden en "go" knap.
Det skal fungere således, at når 2. dropdown vælges, skal der hoppes til pågældende side.
Er der nogen der kan hjælpe?
Scriptet ser således ud:
<CENTER>
<form name="doublecombo">
<p><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>Webmaster Sites</option>
<option>News Sites</option>
<option>Search Engines</option>
</select>
<select name="stage2" size="1">
<option value="http://wsabstract.com">Website Abstraction</option>
<option value="http://www.free-backgrounds.com">Free-backgrounds.com</option>
<option value="http://www.dynamicdrive.com">Dynamic Drive</option>
<option value="http://www.reallybig.com">Reallybig</option>
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>
<script>
<!--
/*
Double Combo Script Credit
By Website Abstraction (www.wsabstract.com)
Visit Java-Scripts.net or Wsabstract.com for this 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("Website Abstraction","http://wsabstract.com")
group[0][1]=new Option("Free-backgrounds.com","http://www.free-backgrounds.com")
group[0][2]=new Option("Dynamic Drive","http://www.dynamicdrive.com")
group[0][3]=new Option("Reallybig","http://www.reallybig.com")
group[1][0]=new Option("CNN","http://www.cnn.com")
group[1][1]=new Option("ABC News","http://www.abcnews.com")
group[2][0]=new Option("Hotbot","http://www.hotbot.com")
group[2][1]=new Option("Infoseek","http://www.infoseek.com")
group[2][2]=new Option("Excite","http://www.excite.com")
group[2][3]=new Option("Lycos","http://www.lycos.com")
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(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>
</form>
</CENTER>
</BODY>
</HTML>