我想做了个页面它有两个下拉列表(其实还可以有更多) 第一个下拉列表中让你选择的省,而另一个下拉列表让你 
选择的是城市,当你在省的下拉列表中的选择发生改变的时候, 
城市的下拉列表也应当跟着你所选择的省名称而发生改变. 
这样就产生了一种联动的较果. 
也就是简单的二级联动.. 要实现这种二级联动的效果要怎么写代码呀,三级联动呢
各位高手帮帮忙,

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【wanchengzi】截止到2008-07-17 00:22:42的历史汇总数据(不包括此帖):
    发帖的总数量:2                        发帖的总分数:40                       每贴平均分数:20                       
    回帖的总数量:0                        得分贴总数量:0                        回帖的得分率:0%                       
    结贴的总数量:1                        结贴的总分数:20                       
    无满意结贴数:0                        无满意结贴分:0                        
    未结的帖子数:1                        未结的总分数:20                       
    结贴的百分比:50.00 %               结分的百分比:50.00 %                  
    无满意结贴率:0.00  %               无满意结分率:0.00  %                  
    楼主加油
      

  2.   

    这上面有说明http://www.hahaxiao.net/faces/website/website.jsp?id=14
      

  3.   

    这种例子你在csdn中随便一搜索就一把一把的,我记得我回答的就不下十个!!!
    自己搜索一下吧
      

  4.   

    前几天刚自己实现了一个,使用的是ajax,每当选择了一个select,触发javascript:onChange()去后台取出下一级菜单项,并放入下一级的select中.
    代码不在身边,晚上给你贴出来.
      

  5.   

    <form name="mform" method="post" action="info_1.jsp" onSubmit="return checkdata();">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
            
             <tr>
     
              <td width="100" height="34" class="font04"><img src="../image/20080101164358722.gif" width="11" height="11" />&nbsp;快速筛选:</td>
       <td height="34" width="100"> 
      <%
    String sql_Dq1 = "select * from Class where Class_F = '13' order by id asc" ;
    ResultSet rs_Dq1 = stmt.executeQuery(sql_Dq1);  
    %>
              <select name="classid" onChange="changelocation(document.mform.classid.options[document.mform.classid.selectedIndex].value)" onFocus="return info('div_Nclassid'); " onBlur="return info_no('div_Nclassid')">
                <%
            out.println("<option value='0' selected>所有省份</option>");
    while(rs_Dq1.next()) {
            out.println("<option value='"+rs_Dq1.getString(1)+"'>"+rs_Dq1.getString(2)+"</option>");
    }
    if (rs_Dq1.next()) {}else{
        out.print("没有记录");
    }
    rs_Dq1.close();
    %></select> </TD>
    <script language = "JavaScript">
    var onecount;
    onecount=0;
    subcat = new Array();
            <%
    String sql_Dq2 = "select * from Class where Class_F <> '0'" ;
    ResultSet rs_Dq2 = stmt2.executeQuery(sql_Dq2);  
            int count = 0;
            while(rs_Dq2.next()) {
            %>
    subcat[<%=count%>] = new Array("<%= rs_Dq2.getString("Class_Name")%>","<%= rs_Dq2.getString("Class_F")%>","<%= rs_Dq2.getString("id")%>");
            <%
            count = count + 1;
            }
            rs_Dq2.close();
    stmt2.close();
            %>
    onecount=<%=count%>;function changelocation(locationid)
        {
    obj=document.mform;
        obj.Nclassid.length = 1; 
        
        var locationid=locationid;
        var i;
        for (i=0;i < onecount; i++)
            {
                if (subcat[i][1] == locationid)
                { 
                    obj.Nclassid.options[obj.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
                }        
            }
            
        }  
    </script>
               <TD width="100" height="34" align="left"><select name=Nclassid id="Nclassid" onFocus="return info('div_Nclassid'); "onBlur="return info_no('div_Nclassid');">
              <option value="0" selected>所有城市</option>
              
            </select></TD> 
              <td width="100"></td>
      <td width="100"></td>
      <td width="100"></td>
      
              
              <td width="100" class="STYLE4" ><img src="../image/20080101163413966.gif" width="13" height="13" />&nbsp;
      <INPUT type=submit value=" 筛选 " name="submit" onClick="return checkdata();">
      </td>
     
            </tr>
          </table>
      

  6.   

    如果只是想在页面上实现省市这样的两级连拉,写死就可以了,别的吗,ajax可以,我推荐你用dwr,很好用,我博客上有篇dwr入门,浅显易懂