模拟数据调试通过,祝你开心<%@ Language=VBscript %> <!--#include file="conn.asp"--> <html> <head> <title>List</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <% dim conn dim rs dim sql dim count dim rs1 dim sql1 sql = "select * from D分局名 order by 分局编号 asc" set rs = conn.execute(sql) %> <script language = "Javascript"> var onecount; onecount=0; subcat = new Array(); <% count = 0 do while not rs.eof %> subcat[<%=count%>] = new Array("<%=rs("D分局名")%>","<%=trim(rs("局编号"))%>","<%=trim(rs("分局编号"))%>"); <% count = count + 1 rs.movenext loop rs.close set rs=nothing %> onecount=<%=count%>;function changelocation(locationid) { document.myform.smalllocation.length = 0; var locationid=locationid; var i; document.myform.smalllocation.options[0] = new Option('=所有分局名=',''); for (i=0;i < onecount; i++) { if (subcat[i][1] == locationid) { document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]); } }
} </script> <% sqlgwdm="select * from D工务段名 order by 编号 asc" set rsgwdm=conn.execute(sqlgwdm) %> <script language = "Javascript"> var onecounty; onecounty=0; subcaty = new Array(); <% county = 0 do while not rsgwdm.eof %> subcaty[<%=county%>] = new Array("<%=rsgwdm("D工务段名")%>","<%=trim(rsgwdm("局编号"))%>","<%=trim(rsgwdm("分局编号"))%>","<%=trim(rsgwdm("编号"))%>"); <% county = county + 1 rsgwdm.movenext loop rsgwdm.close set rsgwdm=nothing %> onecounty=<%=county%>;function changelocationy(locationidy) { document.myform.gwd.length = 0; var locationidy=locationidy; var iy; document.myform.gwd.options[0] = new Option('=所有工务段=',''); for (iy=0;iy < onecounty; iy++) { if (subcaty[iy][2] == locationidy) {
alert(locationidy) document.myform.gwd.options[document.myform.gwd.length] = new Option(subcaty[iy][0], subcaty[iy][3]); } }
sql1 = "select * from D局名 order by 编号 asc" set rs1 = conn.Execute (sql1) do while not rs1.eof %> <option value="<%=trim(rs1("编号"))%>"><%=trim(rs1("D局名"))%></option> <% rs1.movenext loop rs1.close set rs1 = nothing
你可以參考一下pconline.com.cn的今日報價
<!--#include file="conn.asp"-->
<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
dim conn
dim rs
dim sql
dim count
dim rs1
dim sql1
sql = "select * from D分局名 order by 分局编号 asc"
set rs = conn.execute(sql)
%>
<script language = "Javascript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%=rs("D分局名")%>","<%=trim(rs("局编号"))%>","<%=trim(rs("分局编号"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;function changelocation(locationid)
{
document.myform.smalllocation.length = 0; var locationid=locationid;
var i;
document.myform.smalllocation.options[0] = new Option('=所有分局名=','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<%
sqlgwdm="select * from D工务段名 order by 编号 asc"
set rsgwdm=conn.execute(sqlgwdm)
%>
<script language = "Javascript">
var onecounty;
onecounty=0;
subcaty = new Array();
<%
county = 0
do while not rsgwdm.eof
%>
subcaty[<%=county%>] = new Array("<%=rsgwdm("D工务段名")%>","<%=trim(rsgwdm("局编号"))%>","<%=trim(rsgwdm("分局编号"))%>","<%=trim(rsgwdm("编号"))%>");
<%
county = county + 1
rsgwdm.movenext
loop
rsgwdm.close
set rsgwdm=nothing
%>
onecounty=<%=county%>;function changelocationy(locationidy)
{
document.myform.gwd.length = 0; var locationidy=locationidy;
var iy;
document.myform.gwd.options[0] = new Option('=所有工务段=','');
for (iy=0;iy < onecounty; iy++)
{
if (subcaty[iy][2] == locationidy)
{
alert(locationidy)
document.myform.gwd.options[document.myform.gwd.length] = new Option(subcaty[iy][0], subcaty[iy][3]);
}
}
}
</script>
</head>
<body>
<form name="myform" method="post">
<select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)">
<option value="">==所有局名==</option>
<%
sql1 = "select * from D局名 order by 编号 asc"
set rs1 = conn.Execute (sql1)
do while not rs1.eof
%>
<option value="<%=trim(rs1("编号"))%>"><%=trim(rs1("D局名"))%></option>
<%
rs1.movenext
loop
rs1.close
set rs1 = nothing
%>
</select>
<select name="smalllocation" onChange="changelocationy(document.myform.smalllocation.options[document.myform.smalllocation.selectedIndex].value)">
<option selected value="">=所有分局名=</option>
</select>
<select size="1" name="gwd">
<option selected>=所有工务段=</option>
</select>
<input type=button value="yeefly" onclick=javascript:myform.submit();>
</form>
</body>
</html>