<%
sql = "select * from tsvcappl order by apid "
rs.open sql,conn,3,3
%>
<script language = "JavaScript">
<!--
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%=rs("province")%>","<%=rs("city")%>","<%=rs("city")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
'**************************************'
'以上是将数据库中的省市资料写入一个数组 '
'**************************************'
function changeselect1(locationid)
{
document.form1.city.length = 0;
document.form1.city.options[0] = new Option('city','');
for (i=0; i<subcat.length; i++)
{
if (subcat[i][0] == locationid)
{document.form1.city.options[document.form1.city.length] = new Option(subcat[i][1], subcat[i][2]);}
}
}
//-->
</script>
<body>
<form name="form1">
<%
sql = "select * from city"
rs.open sql,conn,3,3
if rs.eof and rs.bof then
response.write "先添加欄目"
response.end
else
%>
<select name="province" onChange="changeselect1(this.value)" size="1">
<option>province</option>
<%
do while not rs.eof
%>
<option value="<%=trim(rs("rmno"))%>"><%=trim(rs("rmno"))%></option>
<select size="1" name="szSheng" onChange=chsel()>
<option value="xxx" selected>请选择省份……</option>
<%
set rs_s=server.createobject("adodb.recordset")
rs_s.open "select * from szSheng order by shengno",conn,1,1
while not rs_s.eof
%>
<option value="<%=rs_s("ShengNo")%>"><%=trim(rs_s("ShengName"))%></option>
<%
rs_s.movenext
wend
rs_s.close
set rs_s=nothing
%>
</select>
<select size="1" name="szShi">
<option value="xxx" selected>请选择城市……</option>
</select>
下边这段加在后边..........
<script language=JavaScript>
<%dim i,j
set rs_s=server.createobject("adodb.recordset")
rs_s.open "select * from szSheng order by shengorder",conn,1,1
%>
var selects=[];
selects['xxx']=new Array(new Option('请选择城市……','xxx'));
<%
for i=1 to rs_s.recordcount
%>
selects['<%=rs_s("ShengNo")%>']=new Array(
<%
set rs_s1=server.createobject("adodb.recordset")
rs_s1.open "select * from szShi where shengno="&rs_s("ShengNo"),conn,1,1
if rs_s1.recordcount>0 then
for j=1 to rs_s1.recordcount
if j=rs_s1.recordcount then
%>
new Option('<%=trim(rs_s1("shiname"))%>','<%=trim(rs_s1("shiNo"))%>'));
<% else
%>
new Option('<%=trim(rs_s1("shiname"))%>','<%=trim(rs_s1("shiNo"))%>'),
<%
end if
rs_s1.movenext
next
else
%>
new Option('','0'));
<%
end if
rs_s1.close
set rs_s1=nothing
rs_s.movenext
next
rs_s.close
set rs_s=nothing
%>
function chsel(){
with (document.shouhuoxx){
if(szSheng.value) {
szShi.options.length=0;