<select onchange="window.location.href='test.asp?id=' + this.value;">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

解决方案 »

  1.   

    我第二个下拉框已经实现了读取第一个下拉选择后的数据.现在的要求是不要第二个下拉框了,当你选择了第一个下拉里的数据后,自动刷新下页面,将你选择的第一个下拉的数据及其下属的数据以table的形式显示出来.
      

  2.   

    这样的啊,这样子好整了啊,<html>   
    <head>   
        <title></title>   
        <script>   
         function showtable()
         {
            //window.location.href='Default.aspx?'
            var newselect=document.getElementById("se");
            var newtable=document.getElementById("t1").insertRow(-1);
            var checkvalue=newselect.value;
            for(var i=0;i<newselect.length;i++)
            {
                var newtr=document.createElement("tr");
                var newtd=document.createElement("td");
                newtd.innerHTML=newselect[i].value;
                newtable.appendChild(newtr);
                newtr.appendChild(newtd);
            }
         }
        </script>   
    </head>   
    <body>   
        <form action="#">
         <select id="se" onchange="showtable()">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
         </select>
         <table id="t1" border=1>
            <tr>
            </tr>
         </table>
        </form>   
    </body>   
    </html>  是这个意思吗
      

  3.   

    不用,但是我觉得还有点不对,我在给你改改
    <html>   
    <head>   
        <title></title>   
        <script>   
              
         function showtable()
         {
            delTable();//调用方法
            //window.location.href='Default.aspx?'
            var newtable=document.getElementById("t1").insertRow(-1);
            var newselect=document.getElementById("se");
            var checkvalue=newselect.value;
            
            var newtr=document.createElement("tr");
            var newtd=document.createElement("td");
            newtd.innerHTML=checkvalue;
            newtable.appendChild(newtr);
            newtr.appendChild(newtd);
            for(var i=0;i<newselect.length;i++)
            {
                if(newselect[i].value==checkvalue)
                {
                    
                }else
                {
                    newtr=document.createElement("tr");
                    newtd=document.createElement("td");
                    newtd.innerHTML=newselect[i].value;
                    newtable.appendChild(newtr);
                    newtr.appendChild(newtd);
                }
            }
         }
         //清楚表格
        function delTable()
        {
            var testTable = document.getElementById("t1");
            while(testTable.hasChildNodes()){
            testTable.removeChild(testTable.lastChild);
            }
        }
        </script>   
    </head>   
    <body>   
        <form action="#">
         <select id="se" onchange="showtable()">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
         </select>
         <table id="t1" border=1>
            <tr>
            </tr>
         </table>
        </form>   
    </body>   
    </html>  
      

  4.   

    那这样子,刷新页面是肯定要刷新的了,你选择中国的时候就要进入数据库了去取对应的数据了,返回到这个页面你能传个数组过来,同时也要把“中国”的id传过来,然后在js里遍历这个数组,效果就出来了你能做到这样吗,遍历数组和从新加载那个中国的id,你就会看到刷新后页面上中国是选好了的,下面也是他对应的城市
      

  5.   

    要的
    发到我的qq邮箱[email protected]
      

  6.   

    收到了,你这个是jsp啊,幸好不是asp,.jsp,我应该还行,现在做的是aspx,那好,你==我,我争取下班前给你弄出来