<script type="text/javascript" src=xxx.js>
</script>xxx.js:
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("请选择城市","0")group[1][0]=new Option("ddd","444")
group[1][1]=new Option("eee","555")
group[1][2]=new Option("fff","666")group[2][0]=new Option("ggg","777")
group[2][1]=new Option("hhh","888")
group[2][2]=new Option("iii","999")
group[2][3]=new Option("kkk","1010")var temp=document.doublecombo.stage2function 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
}

解决方案 »

  1.   

    HTML:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>双选择关联菜单</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <META content="MSHTML 5.50.4134.600" name=GENERATOR>
    </HEAD>
    <BODY id=all text=#000000 bgColor=#336699>
    <form name="doublecombo">
    <p>
    <select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
    <option value="">请选择省份</option>
    <option value="北京市">北京</option>
    <option value="上海市">上海</option>
    </select>
    <select name="stage2" size="1">
    <option value="0">请选择城市</option>
    </select>
    <input type="button" name="test" value="Go!" onClick="go()">
    </p><script type="text/javascript" src=xxx.js>
    </script></form>
    </BODY>
    </HTML>
      

  2.   

    xxx.js:
    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("请选择城市","0")group[1][0]=new Option("ddd","444")
    group[1][1]=new Option("eee","555")
    group[1][2]=new Option("fff","666")group[2][0]=new Option("ggg","777")
    group[2][1]=new Option("hhh","888")
    group[2][2]=new Option("iii","999")
    group[2][3]=new Option("kkk","1010")var temp=document.doublecombo.stage2function 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
    }