asp二级联动

asp+js实现的二级联动

 

<script language="javascript">
function chan(){
lhttp="addwzh.asp?dl="+document.all.dl.value;
self.location=lhttp;
}

</script>

 

大类

<% set rs= Server.CreateObject("adodb.recordset")
      sql="select id,nam from bigclass"
      rs.open sql,conn,1,1 %>
                    <select name="dl" size="1" id="dl" onChange="chan();">
                      <% while not rs.eof %>
                      <option value="<%=rs("id")%>" <% if dl=cstr(rs("id")) then response.write " selected"%>><%=rs("nam")%></option>
                      <% rs.movenext
      wend %>
                    </select> 
                    <% rs.close
     %>

 

小类

<% 
      rs.open "select id,sclass from smallclass where bclass="&dl,conn,1,1%>
                    <select name="xl" size="1">
                      <% while not rs.eof
      response.write "<option value=" & rs("id")
      response.write ">"&trim(rs("sclass"))&"</option>"
      rs.movenext 
     wend
     rs.close
     %>

posted on 2013-02-28 11:13  fyw  阅读(312)  评论(0编辑  收藏  举报

导航