mySelect = new Array();
mySelect[0] = new Array("桂林街道","朝阳区","/shequ/selectServlet?key=桂林街道");
mySelect[1] = new Array("红旗街道","朝阳区","/shequ/selectServlet?key=红旗街道");
mySelect[2] = new Array("湖西街道","朝阳区","/shequ/selectServlet?key=湖西街道");
mySelect[3] = new Array("南湖街道","朝阳区","/shequ/selectServlet?key=南湖街道");
mySelect[4] = new Array("南站街道","朝阳区","/shequ/selectServlet?key=南站街道");
mySelect[5] = new Array("清和街道","朝阳区","/shequ/selectServlet?key=清和街道");
mySelect[6] = new Array("永昌街道","朝阳区","/shequ/selectServlet?key=永昌街道");
mySelect[41] = new Array("桃源街道","南关区","/shequ/selectServlet?key=桃源街道");
mySelect[42] = new Array("永吉街道","南关区","/shequ/selectServlet?key=永吉街道");
mySelect[43] = new Array("自强街道","南关区","/shequ/selectServlet?key=自强街道");count=43;function csChoose(locationid)
    {
    document.myform.csList2.length = 0;     var locationid=locationid;
    var i;
    document.myform.csList2.options[0] = new Option('====请选择====','');
    for (i=0;i < count; i++)
        {
            if (mySelect[i][1] == locationid)
            { 
            document.myform.csList2.options[document.myform.csList2.length] = new Option(mySelect[i][0], mySelect[i][2]);
            }        
        }
    } 
</script>
    <select name="csList" onChange="csChoose(document.myform.csList.options[document.myform.csList.selectedIndex].value)">
<option value="">===请选择===</option>
        <option value="朝阳区">朝阳区</option>
<option value="二道区">二道区</option>
<option value="高新区">高新区</option>
<option value="经济开发区">经济开发区</option>
<option value="宽城区">宽城区</option>
<option value="绿园区">绿园区</option>
 </select>

        <select name="csList2"  onchange="window.location.href=this.options[this.selectedIndex].value"> 
        <option selected value="">==请选择==</option>
    </select>
    <br>
    <br>
</td></tr></table> 我做的二级联动菜单,现在想在二级下拉菜单改变的时候去调用js脚本中的startRequest()
但是这里onchange="window.location.href=this.options[this.selectedIndex].value" 需要获得
二级菜单的值,我不指导如何把这个参数给脚本传递过去请大家指教

解决方案 »

  1.   

    不太明白你提的问题的 需求都没说清楚啊
    还有你这个 document.myform.csList2.length = 0; 这段是什么意思
    我看你估计是头昏了
    我猜你是想构造一个select 那你直接用js构造下整个select好了 
    一点要怎么想办法给select设置option干什么呢 (主要是我也不知道怎么搞)
    你就在页面上搞个<div id="csList2"> </dive>
    然后在js里搞个select的字符串给这个div就好了 
      

  2.   

    function csChoose() 
    {
       var locationid=document.getElementsByName('csList')[0].value;
       ...................................................

      

  3.   

    长春老乡,是这个意思不?<select name="csList2"  onchange="startRequest()">function startRequest(){
    alert(document.myform.csList2.value);
    //window.location.href=....
    }
      

  4.   

    http://topic.csdn.net/u/20081022/10/b64ccfc7-864e-47cf-9093-e8490b8ec03e.html
    这里我写了一个3级联动的。从数据库里取值。。
    可以参考一下~!
      

  5.   

    http://topic.csdn.net/u/20081022/10/b64ccfc7-864e-47cf-9093-e8490b8ec03e.html 
    顶楼上~