<!--要完成此效果把如下代码加入到--> <body> <FORM name=doublecombo> <P align=center><SELECT name=example onchange=redirect(this.options.selectedIndex) size=1> <option>石家庄拓展公司</option> <option>总类二</option> <option>总类三</option> </SELECT> <SELECT name=stage2 size=1> <option value="link.htm">分类一</option> <option value="link.htm">分类二</option> <option value="link.htm">分类三</option> <option value="link.htm">分类四</option> </SELECT> <INPUT name=test onclick=go() type=button value=Go!></P> <SCRIPT language=JavaScript> <!-- 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("分类一","#") group[0][1]=new Option("分类二","#") group[0][2]=new Option("分类三","#") group[0][3]=new Option("分类四","#") group[1][0]=new Option("分类一","#") group[1][1]=new Option("分类二","#") group[1][2]=new Option("分类三","#") group[2][0]=new Option("分类一","#") group[2][1]=new Option("分类二","#") 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>
时间: 2024-10-08 10:04:00