省市区三级联动连接数据库

<table width="200" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td>
          
          <select name="P_JuZhuDi_Area" id="P_JuZhuDi_Area" onChange="changepro('P_JuZhuDi_City','P_JuZhuDi_Area');">
              <option value="" selected>省/直辖市</option>
              <option value='北京市' <% If P_JuZhuDi_Area = "北京市" Then Response.write "Selected" %>>北京市</option>
              <option value='天津市' <% If P_JuZhuDi_Area = "天津市" Then Response.write "Selected" %>>天津市</option>
              <option value='河北省' <% If P_JuZhuDi_Area = "河北省" Then Response.write "Selected" %>>河北省</option>
              <option value='山西省' <% If P_JuZhuDi_Area = "山西省" Then Response.write "Selected" %>>山西省</option>
              <option value='内蒙古区' <% If P_JuZhuDi_Area = "内蒙古区" Then Response.write "Selected" %>>内蒙古区</option>
              <option value='辽宁省' <% If P_JuZhuDi_Area = "辽宁省" Then Response.write "Selected" %>>辽宁省</option>
              <option value='吉林省' <% If P_JuZhuDi_Area = "吉林省" Then Response.write "Selected" %>>吉林省</option>
              <option value='黑龙江省' <% If P_JuZhuDi_Area = "黑龙江省" Then Response.write "Selected" %>>黑龙江省</option>
              <option value='上海市' <% If P_JuZhuDi_Area = "上海市" Then Response.write "Selected" %>>上海市</option>
              <option value='江苏省' <% If P_JuZhuDi_Area = "江苏省" Then Response.write "Selected" %>>江苏省</option>
              <option value='浙江省' <% If P_JuZhuDi_Area = "浙江省" Then Response.write "Selected" %>>浙江省</option>
              <option value='安徽省' <% If P_JuZhuDi_Area = "安徽省" Then Response.write "Selected" %>>安徽省</option>
              <option value='福建省' <% If P_JuZhuDi_Area = "福建省" Then Response.write "Selected" %>>福建省</option>
              <option value='江西省' <% If P_JuZhuDi_Area = "江西省" Then Response.write "Selected" %>>江西省</option>
              <option value='山东省' <% If P_JuZhuDi_Area = "山东省" Then Response.write "Selected" %>>山东省</option>
              <option value='河南省' <% If P_JuZhuDi_Area = "河南省" Then Response.write "Selected" %>>河南省</option>
              <option value='湖北省' <% If P_JuZhuDi_Area = "湖北省" Then Response.write "Selected" %>>湖北省</option>
              <option value='湖南省' <% If P_JuZhuDi_Area = "湖南省" Then Response.write "Selected" %>>湖南省</option>
              <option value='广东省' <% If P_JuZhuDi_Area = "广东省" Then Response.write "Selected" %>>广东省</option>
              <option value='广西区' <% If P_JuZhuDi_Area = "广西区" Then Response.write "Selected" %>>广西区</option>
              <option value='海南省' <% If P_JuZhuDi_Area = "海南省" Then Response.write "Selected" %>>海南省</option>
              <option value='重庆市' <% If P_JuZhuDi_Area = "重庆市" Then Response.write "Selected" %>>重庆市</option>
              <option value='四川省' <% If P_JuZhuDi_Area = "四川省" Then Response.write "Selected" %>>四川省</option>
              <option value='贵州省' <% If P_JuZhuDi_Area = "贵州省" Then Response.write "Selected" %>>贵州省</option>
              <option value='云南省' <% If P_JuZhuDi_Area = "云南省" Then Response.write "Selected" %>>云南省</option>
              <option value='西藏区' <% If P_JuZhuDi_Area = "西藏区" Then Response.write "Selected" %>>西藏区</option>
              <option value='陕西省' <% If P_JuZhuDi_Area = "陕西省" Then Response.write "Selected" %>>陕西省</option>
              <option value='甘肃省' <% If P_JuZhuDi_Area = "甘肃省" Then Response.write "Selected" %>>甘肃省</option>
              <option value='青海省' <% If P_JuZhuDi_Area = "青海省" Then Response.write "Selected" %>>青海省</option>
              <option value='宁夏区' <% If P_JuZhuDi_Area = "宁夏区" Then Response.write "Selected" %>>宁夏区</option>
              <option value='新疆区' <% If P_JuZhuDi_Area = "新疆区" Then Response.write "Selected" %>>新疆区</option>
              <option value='台湾省' <% If P_JuZhuDi_Area = "台湾省" Then Response.write "Selected" %>>台湾省</option>
              <option value='香港特区' <% If P_JuZhuDi_Area = "香港特区" Then Response.write "Selected" %>>香港特区</option>
              <option value='澳门特区' <% If P_JuZhuDi_Area = "澳门特区" Then Response.write "Selected" %>>澳门特区</option>
          </select></td>
          <td>
  <%
        set rs=server.CreateObject("adodb.recordset")
        sql = "select * from Ejz_User"
        rs.Open sql,conn,1,1
        %>
        <select name="P_JuZhuDi_City" id="P_JuZhuDi_City" onChange="changecity('P_JuZhuDi_xian','P_JuZhuDi_City');">
           <option value="">请选择</option>
              <%do while not rs.eof%>
           <option value="<%=rs("P_JuZhuDi_City")%>" <% If P_JuZhuDi_City = rs("P_JuZhuDi_City") Then Response.write "Selected" %>><%=rs("P_JuZhuDi_City")%></option>
              <%
        rs.movenext
        loop
        rs.close
        set rs=nothing
        %>
          </select></td>
          <td>
        <%
        set rs=server.CreateObject("adodb.recordset")
        sql = "select * from Ejz_User"
        rs.Open sql,conn,1,1
        %>
          <select name="P_JuZhuDi_xian" id="P_JuZhuDi_xian" >
          <option value="">请选择</option>
    <%do while not rs.eof%>
       <option value="<%=rs("P_JuZhuDi_xian")%>" <% If P_JuZhuDi_xian = rs("P_JuZhuDi_xian") Then Response.write "Selected" %>><%=rs("P_JuZhuDi_xian")%></option>
          <%
        rs.movenext
        loop
        rs.close
        set rs=nothing
        %>
          </select></td>
        </tr>
    </table>

 

JS文件:http://download.csdn.net/detail/liuswi/4667134

 

posted @ 2012-11-05 09:52  Liu66~  阅读(2437)  评论(0编辑  收藏  举报