输入:两个select。
输出:选择第一个select下拉项时,第二个select发生变化(把第一个的参数传过来,拼接后返回结果)应该怎么处理呢。给点拨下思路。
有简单例子的话不胜感激。

解决方案 »

  1.   

    第一个select加onchange=kk(this.value),然后function kk(id){ajax...,第二个select清空option,组建新的option}
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=gb2312">
    <title> new document </title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <script type="text/javascript">
    <!--
    var a = [{id:1,v:"a"},{id:1,v:"b"},{id:1,v:"c"},{id:2,v:"d"},{id:2,v:"e"}]
    function kk (id) {
    var obj = document.getElementById("s2").options;
    obj.length=0;
    for (var i=0; i<a.length; i++) {
    if (a[i].id==id) {
    obj[obj.length]=new Option(a[i].v,a[i].v);
    }
    }
    }
    window.onload=function(){kk(1)}
    //-->
    </script>
    </head>
    <body>
    <select id="s1" onchange="kk(this.value)">
    <option value="1" selected>1</option>
    <option value="2">2</option>
    </select>
    <select id="s2">
    </select>
    </body>
    </html>
      

  3.   

    http://blog.csdn.net/hch126163/archive/2010/12/07/6059906.aspx