<%
set rs=server.createobject("adodb.recordset")
sql = "select * from district order by locationname asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("districtname"))%>","<%= trim(rs("locationname"))%>","<%= trim(rs("districtid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;
function changelocation(lo)
{
document.myform.smalllocation.length = 0;
var lo=lo;
document.myform.smalllocation.options[0] = new Option('==所选城市的地区==','');
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == lo)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<%
set rs2=server.createobject("adodb.recordset")
sql2= "select * from village order by districtname asc"
rs2.open sql2,conn,1,1
%>
<script language = "JavaScript">
var onecount2;
onecount2=0;
subcat2 = new Array();
<%
count2 = 0
do while not rs2.eof
%>
subcat2[<%=count2%>] = new Array("<%= trim(rs2("villagename"))%>","<%= trim(rs2("districtname"))%>","<%= trim(rs2("villageid"))%>");
<%
count2 = count2 + 1
rs2.movenext
loop
rs2.close
set rs2=nothing
%>
onecount2=<%=count2%>;
function changelocation2(vi)
{
document.myform.village.length = 0;
var vi=vi;
var j;
for (j=0;j < onecount2; j++)
{
if (subcat2[j][0] == vi)
{
document.myform.village.options[document.myform.village.length] = new Option(subcat2[j][0], subcat2[j][2]);
}
}
}
</script>
<form name="myform" method="post">
<select name="biglocation" onChange="changelocation(document.myform.biglocation.options.value)" size="1">
<option selected>请选择你所在的省份</option>
<%
sql1 = "select * from location order by locationid asc"
set rs1 = conn.Execute (sql1)
do while not rs1.eof
%>
<option value="<%=trim(rs1("locationname"))%>"><%=trim(rs1("locationname"))%></option>
<%
rs1.movenext
loop
rs1.close
set rs1 = nothing
conn.Close
set conn = nothing
%>
</select><select name="smalllocation" onChange="changelocation2(document.myform.smalllocation.options.value)">
<option selected value="">==所有地区==</option>
</select><select name="village" size="1">
<option selected>==所有县区==</option>
</select>
</form>
set rs=server.createobject("adodb.recordset")
sql = "select * from district order by locationname asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("districtname"))%>","<%= trim(rs("locationname"))%>","<%= trim(rs("districtid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;
function changelocation(lo)
{
document.myform.smalllocation.length = 0;
var lo=lo;
document.myform.smalllocation.options[0] = new Option('==所选城市的地区==','');
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == lo)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<%
set rs2=server.createobject("adodb.recordset")
sql2= "select * from village order by districtname asc"
rs2.open sql2,conn,1,1
%>
<script language = "JavaScript">
var onecount2;
onecount2=0;
subcat2 = new Array();
<%
count2 = 0
do while not rs2.eof
%>
subcat2[<%=count2%>] = new Array("<%= trim(rs2("villagename"))%>","<%= trim(rs2("districtname"))%>","<%= trim(rs2("villageid"))%>");
<%
count2 = count2 + 1
rs2.movenext
loop
rs2.close
set rs2=nothing
%>
onecount2=<%=count2%>;
function changelocation2(vi)
{
document.myform.village.length = 0;
var vi=vi;
var j;
for (j=0;j < onecount2; j++)
{
if (subcat2[j][0] == vi)
{
document.myform.village.options[document.myform.village.length] = new Option(subcat2[j][0], subcat2[j][2]);
}
}
}
</script>
<form name="myform" method="post">
<select name="biglocation" onChange="changelocation(document.myform.biglocation.options.value)" size="1">
<option selected>请选择你所在的省份</option>
<%
sql1 = "select * from location order by locationid asc"
set rs1 = conn.Execute (sql1)
do while not rs1.eof
%>
<option value="<%=trim(rs1("locationname"))%>"><%=trim(rs1("locationname"))%></option>
<%
rs1.movenext
loop
rs1.close
set rs1 = nothing
conn.Close
set conn = nothing
%>
</select><select name="smalllocation" onChange="changelocation2(document.myform.smalllocation.options.value)">
<option selected value="">==所有地区==</option>
</select><select name="village" size="1">
<option selected>==所有县区==</option>
</select>
</form>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货