问题:根据选择城市触发框架子页查询符合该城市数据,框架名称scity,子页searcity.asp
最后能够以searcity.asp?id=<%rs("id_")%>这样方式传递,searcity.asp捕捉到城市编码可以查询相应数据。感谢!市代码如下:
<script language = "JavaScript"> var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("id_"))%>","<%= trim(rs("mindex_"))%>","<%= trim(rs("statecity_"))%>[<%=trim(rs("zip_"))%>]");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>; function changelocation(locationid)
{
document.myform.SmallClassName.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][2], subcat[i][0]);
}
}
} </script>省份部份代码
<%
set rs=server.createobject("adodb.recordset")
sql = "select * from dqpm where sid_=0"
rs.open sql,conn,1,1if rs.eof and rs.bof then
response.write "请先添加栏目。"
else
%><select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
<option selected>State Code</option>
<%
do while not rs.eof
%>
<option value="<%=trim(rs("mindex_"))%>"><%=trim(rs("statecity_"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
最后能够以searcity.asp?id=<%rs("id_")%>这样方式传递,searcity.asp捕捉到城市编码可以查询相应数据。感谢!市代码如下:
<script language = "JavaScript"> var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("id_"))%>","<%= trim(rs("mindex_"))%>","<%= trim(rs("statecity_"))%>[<%=trim(rs("zip_"))%>]");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>; function changelocation(locationid)
{
document.myform.SmallClassName.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][2], subcat[i][0]);
}
}
} </script>省份部份代码
<%
set rs=server.createobject("adodb.recordset")
sql = "select * from dqpm where sid_=0"
rs.open sql,conn,1,1if rs.eof and rs.bof then
response.write "请先添加栏目。"
else
%><select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
<option selected>State Code</option>
<%
do while not rs.eof
%>
<option value="<%=trim(rs("mindex_"))%>"><%=trim(rs("statecity_"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
changelocation(
document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)你可以先在changelocationa 里alert看看取到的locationid是什么,还有subcat数组是否是取到值了.