asp 联动菜单问题
网上复制的代码,数据库根据网上介绍制作,为什么第二个选择菜单没有数据?(第一个选择菜单有数据)请教
全部代码如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
dim conn
set conn =server.createobject("adodb.connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&server.MapPath("db\database1.mdb")
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<table width="1002" border="0">
<tr>
<td height="253"><form id="form1" name="form1" method="post" action="">
<p>
<label for="select"></label>
<select name="Province_select" onChange=chsel()>
<option value="xxx" selected>请选择省份……</option>
<%
dim tmpid '定义一个临时变量用来记住省id
tmpid=0
set rs_Province=server.CreateObject("ADODB.recordset")
sql="select * from Province order by ProvinceOrder"
rs_Province.open sql,conn,1,1
while not rs_Province.eof
tmpid=rs_Province("id")
%>
<option value="<%=rs_Province("ProvinceNo")%>" ><%=trim(rs_Province("ProvinceName"))%></option>
<%
rs_Province.movenext
wend
rs_Province.close
set rs_Province=nothing
%>
</select>
</p>
<p> </p>
<p>
<label for="select2"></label>
<select name="City_select">
<%
set rs_City=server.createobject("adodb.recordset")
sql="select * from City where ProvinceID="&tmpid&" order by CityOrder"
rs_City.open sql,conn,1,1
while not rs_City.eof
%>
<option value="<%=rs_City("CityNo")%>"><%=trim(rs_City("CityName"))%></option>
<%
rs_City.movenext
wend
rs_City.close
set rs_City=nothing
%>
</select>
</p>
</form></td>
</tr>
</table>
<script language=JavaScript>
<%
dim sql,i,j
'//////////////////////////读出 Province 表//////////////////////////
set rs_Province=server.createobject("adodb.recordset")
sql="select * from Province order by ProvinceOrder"
rs_Province.open sql,conn,1,1
%>
var selects=[];
selects['xxx']=new Array(new Option('请选择城市……','xxx'));
<%
for i=1 to rs_s.recordcount
%>
selects['<%=rs_Province("ProvinceNo")%>']=new Array(
<%
'//////////////////////////读出 City 表//////////////////////////
set rs_City=server.createobject("adodb.recordset")
sql="select * from City where ProvinceID="&rs_Province("id")&" order by ProvinceOrder"
rs_City.open sql,conn,1,1
if rs_City.recordcount>0 then
for j=1 to rs_City.recordcount
if j=rs_City.recordcount then
%>
new Option('<%=trim(rs_City("CityName"))%>','<%=trim(rs_City("CityNo"))%>'));
<%else%>
new Option('<%=trim(rs_City("Cityname"))%>','<%=trim(rs_City("CityNo"))%>'),
<%
end if
rs_City.movenext
next
else
%>
new Option('','0'));
<%
end if
rs_City.close
set rs_City=nothing
rs_Province.movenext
next
rs_Province.close
set rs_Province=nothing
%>
<!--//////////JavaScript控制联动///////////-->
function chsel(){
with (document.form1){
if(province_select.value) {
city_select.options.length=0;
for(var i=0;i<selects[province_select.value].length;i++){
city_select.add(selects[province_select.value][i]);
}
}
}
}
</script>
</body>
</html>