<script language="javascript">
<%
'''取市别列表
dim rstw,sqltw
sqltw=""
sqltw="select * from tbTownInfo order by ProvinceID,TownID"
set rstw=server.CreateObject("adodb.recordset")
rstw.Open sqltw,conn,1,1
'''取县别列表
dim rscy,rscy3,rscy4,sqlcy
sqlcy=""
sqlcy="select * from tbCountyInfo where TownID in (select TownID from tbTownInfo where ProvinceID<16) order by TownID,CountyID"
set rscy=server.CreateObject("adodb.recordset")
rscy.CursorLocation=3
rscy.Open sqlcy,conn,1,3
sqlcy=""
sqlcy="select * from tbCountyInfo where TownID in (select TownID from tbTownInfo where ProvinceID>15 and ProvinceID<26) order by TownID,CountyID"
set rscy3=server.CreateObject("adodb.recordset")
rscy3.CursorLocation=3
rscy3.Open sqlcy,conn,1,3
sqlcy=""
sqlcy="select * from tbCountyInfo where TownID in (select TownID from tbTownInfo where ProvinceID>25) order by TownID,CountyID"
set rscy4=server.CreateObject("adodb.recordset")
rscy4.CursorLocation=3
rscy4.Open sqlcy,conn,1,3
%>
////将市别放入数组
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
if rstw.recordcount>0 then
do while not rstw.eof
%>
subcat[<%=count%>] = new Array("<%=rstw("ProvinceID")%>","<%=trim(rstw("TownCnName"))%>","<%=rstw("TownID")%>","<%=trim(rstw("TownEnName"))%>");
<%
count = count + 1
rstw.movenext
loop
else
count=-1
end if
rstw.close
set rstw=nothing
%>
onecount=<%=count%>;
////将县别放入数组
var onecount2;
onecount2=0;
subcat2 = new Array();
<%
count2 = 0
if rscy.recordcount>0 then
do while not rscy.eof
%>
subcat2[<%=count2%>] = new Array("<%=rscy("TownID")%>","<%=trim(rscy("CountyCnName"))%>","<%=rscy("CountyID")%>","<%=trim(rscy("CountyEnName"))%>");
<%
count2 = count2 + 1
rscy.movenext
loop
else
count2=-1
end if
rscy.close
set rscy=nothing
%>
onecount2=<%=count2%>;
var onecount3;
onecount3=0;
subcat3 = new Array();
<%
count3 = 0
if rscy3.recordcount>0 then
do while not rscy3.eof
%>
subcat3[<%=count3%>] = new Array("<%=rscy3("TownID")%>","<%=trim(rscy3("CountyCnName"))%>","<%=rscy3("CountyID")%>","<%=trim(rscy3("CountyEnName"))%>");
<%
count3 = count3 + 1
rscy3.movenext
loop
else
count3=-1
end if
rscy3.close
set rscy3=nothing
%>
onecount3=<%=count3%>;
var onecount4;
onecount4=0;
subcat4 = new Array();
<%
count4 = 0
if rscy4.recordcount>0 then
do while not rscy4.eof
%>
subcat4[<%=count4%>] = new Array("<%=rscy4("TownID")%>","<%=trim(rscy4("CountyCnName"))%>","<%=rscy4("CountyID")%>","<%=trim(rscy4("CountyEnName"))%>");
<%
count4 = count4 + 1
rscy4.movenext
loop
else
count4=-1
end if
rscy4.close
set rscy4=nothing
%>
onecount4=<%=count4%>;
</script>
//通过省份选择地级市
document.frmsrh.TownID.length = 0;
var locationid=locationid;
var i;
var j;
document.frmsrh.TownID.options[0] = new Option('地级市','');
if (i<0)
{
document.frmsrh.TownID.options[document.frmsrh.TownID.length] = new Option('地级市','0');
}
else
{
for (i=0;i < onecount; i++)
{
if (subcat[i][0] == locationid)
{
document.frmsrh.TownID.options[document.frmsrh.TownID.length] = new Option(subcat[i][1],subcat[i][2]);
}
}
document.frmsrh.TownID.options[0].selected=true;
}
changeposition2(document.frmsrh.TownID.options[0].value);
}
else
{
frmsrh.TownID.style.visibility="visible";
frmsrh.CountyID.style.visibility="visible";
document.frmsrh.TownID.length = 0;
document.frmsrh.TownID.options[0] = new Option('地级市','');
document.frmsrh.CountyID.length = 0;
document.frmsrh.CountyID.options[0] = new Option('县市选择','');
}
}
}
function changeposition2(locationid)
{
var flagc;
flagc=0
//通过地级市选择县别
document.frmsrh.CountyID.length = 0;
var locationid=locationid;
var i,cid;
cid=0
document.frmsrh.CountyID.options[0] = new Option('县市选择','');
if (i<0)
{
document.frmsrh.CountyID.options[document.frmsrh.CountyID.length] = new Option('县市选择','0');
}
else
{
for (i=0;i < onecount2; i++)
{
if (subcat2[i][0] == locationid)
{
//if(document.frmsrh.CountyID.length==1){cid=i;}
document.frmsrh.CountyID.options[document.frmsrh.CountyID.length] = new Option(subcat2[i][1],subcat2[i][2]);
}
}
for (i=0;i < onecount3; i++)
{
if (subcat3[i][0] == locationid)
{
//if(document.frmsrh.CountyID.length==1){cid=i;}
document.frmsrh.CountyID.options[document.frmsrh.CountyID.length] = new Option(subcat3[i][1],subcat3[i][2]);
}
}
for (i=0;i < onecount4; i++)
{
if (subcat4[i][0] == locationid)
{
//if(document.frmsrh.CountyID.length==1){cid=i;}
document.frmsrh.CountyID.options[document.frmsrh.CountyID.length] = new Option(subcat4[i][1],subcat4[i][2]);
}
}