#12004/7/28 9:00:46
<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("Shengname")%>']=new Array(
<%
set rs_s1=server.createobject("adodb.recordset")
rs_s1.open "select * from szShi where shengid="&rs_s("id")&" order by shiorder",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("shiname"))%>'));
<% else
%>
new Option('<%=trim(rs_s1("shiname"))%>','<%=trim(rs_s1("shiname"))%>'),
<%
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;
for(var i=0;i<selects[szSheng.value].length;i++){
szShi.add(selects[szSheng.value][i]);
}
}
}
}
</script>
在HTML中
<select size="1" name="szSheng" onChange=chsel() class="wenbenkuang">
<option value="xxx" selected>请选择省份……</option>
<%
set rs_s=server.createobject("adodb.recordset")
rs_s.open "select * from szSheng order by shengorder",conn,1,1
while not rs_s.eof
%>
<option value="<%=rs_s("ShengName")%>"><%=trim(rs_s("ShengName"))%></option>
<%
rs_s.movenext
wend
rs_s.close
set rs_s=nothing
%>
</select>
<select size="1" name="szShi" onChange=chsel1() class="wenbenkuang">
<option value="xxx" selected>请选择城市……</option>
</select>
<select size="1" name="ting" class="wenbenkuang">
<option value="xxx" selected>请选择营业厅……</option>
</select>
这样做能实现选择省确定到市,但是市选择不到营业厅
请问如何做到市联动到厅
谢谢