日期:2014-05-17  浏览次数:20813 次

求一个ACCESS数据库表的ASP三级联动代码
如题

------解决方案--------------------
例子
http://www.cnmiss.cn/?p=30
http://www.heiqu.com/show-13904-1.html
------解决方案--------------------
HTML code
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<!--#include file="conn.asp"-->

<% lb1=Trim(Request.Form("lb1"))
lb2=Trim(Request.Form("lb2"))
lb3=Trim(Request.Form("lb3"))

%>
<form action="" method="post" name="form1" id="form1"><table width="200" border="1">
  <tr>
    <td>大类</td>
    <td>二级分类</td>
    <td>三级分类</td>
  </tr>
 
  <tr>
    <td><label>
      <select name="lb1" onChange="document.form1.submit()">
        <option value="0">请选择</option>
  <% sql="SELECT bianhao,showname FROM tb1 where lx='1' order by bianhao "
 Set rs=Server.CreateObject("adodb.recordset")
 rs.Open sql,conn,1,1 
 do while not rs.eof %>
   <option value="<%= rs(0) %>"<% if rs(0)=lb1 then Response.Write("selected") %> ><%= rs(1 )%></option>
   <% 
 
  
   rs.movenext
   loop
   rs.close %>
            </select>
    </label></td>
    <td><label>
      <select name="lb2" onChange="document.form1.submit()">
        <option value="0">请选择</option>
       <%  if lb1<>0 then
  sql="SELECT bianhao,showname FROM tb1 where lx='2'  and lbid='"&lb1&"' order by bianhao "

 rs.Open sql,conn,1,1 
 do while not rs.eof %>
   <option value="<%= rs(0) %>" <% if rs(0)=lb2 then Response.Write("selected") %>><%= rs(1 )%></option>
   <% 
 
  
   rs.movenext
   loop
   rs.close 
   end if%>
   </select>
    </label></td>
    <td><label>
      <select name="lb3">
        <option value="0">请选择</option>
       <%  if lb2<>0 then
  sql="SELECT bianhao,showname FROM tb1 where lx='3'  and lbid='"&lb2&"' order by bianhao "

 rs.Open sql,conn,1,1 
 do while not rs.eof %>
   <option value="<%= rs(0) %>" ><%= rs(1 )%></option>
   <% 
  
   rs.movenext
   loop
   rs.close 
   end if%>
   </select>
    </label></td>
  </tr>
   <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
  
</form>
</body>
</html>