asp +access 单表 三级联动 如:表aaaa 字段:ID ,大类,中类,小类。
<%
connstr="provider=microsoft.jet.oledb.4.0;data source="& Server.MapPath("data.mdb")
set conn=Server.CreateObject("adodb.connection")
conn.open connstr
set rs=Server.CreateObject("adodb.recordset")
rs.open "select * from fl",conn,1,1
data_source=rs.GetRows
rs.close
%>
<body>
<h3>三级联动</h3>
<select name="q" id="q"></select>
<select name="w" id="w"></select>
<select name="e" id="e"></select>
<script>
var win=new ld_class();
function ld_class(){
this.arr=new Array();
<%for i=0 to ubound(data_source,2)%>
this.arr[this.arr.length]=new Array("<%=data_source(0,i)%>","<%=data_source(1,i)%>","<%=data_source(2,i)%>");
<%next%>
this.q=$("q");
this.w=$("w");
this.e=$("e");
this.load_=function(){
win.bind_(win.q,0);
win.bind_(win.w,win.q.value);
win.bind_(win.e,win.w.value);
win.q.onchange=function(){
win.bind_(win.w,this.value);
win.bind_(win.e,win.w.value);
};
win.w.onchange=function(){
win.bind_(win.e,this.value);
};
};
this.bind_=function(obj,fla){
obj.length=0;
for(var i=0;i<win.arr.length;i++){
if(win.arr[i][2]==fla){
obj.options[obj.length]=new Option(win.arr[i][1],win.arr[i][0]);
}
}
};
}
win.load_();
function $(id){return document.getElementById(id);}
</script>
</body>