<html>
<head>
</head>
<body>
<form name="doublecombo">
<p>
<select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>List</option>
<option>Select</option>
<option>Choice</option>
</select>
<select name="stage2" size="1">
<option value="http://komputerbelajar.blogspot.com">List</option>
<option value="http://komputerbelajar.blogspot.com">Select</option>
<option value="http://komputerbelajar.blogspot.com">Choice</option>
</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("list 1","http://www.wired.com")
group[0][1]=new Option("list 2","http://www.wired.com")
group[1][0]=new Option("Select 1","http://komputerbelajar.blogspot.com")
group[1][1]=new Option("Select 2","http://komputerbelajar.blogspot.com")
group[2][0]=new Option("Choice 3","http://komputerbelajar.blogspot.com")
group[2][1]=new Option("Choice 4","http://komputerbelajar.blogspot.com")
group[2][2]=new Option("Choice 5","http://komputerbelajar.blogspot.com")
group[2][3]=new Option("Choice 6","http://komputerbelajar.blogspot.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>
</body>
</html>
atau maw download di sini. ntar tinggal jalanin aja... :-)
No comments:
Post a Comment