二级联动问题……找高手解决!
我刚开始学习asp 省市联动 默认值的设置和选择后对上一次所选的清空,找高手解决啊……
<!--#include file="inc\conn.asp"-->
<HTML>
<HEAD>
<Title>addressexample.asp</Title>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<META name="Generator" content="Asp Studio 1.0">
</HEAD>
<%
dim selectRs,selectSql,selecttwonRs,selecttwonSql,i
set selectRs=Server.CreateObject("adodb.recordset")
selectSql="select* from save_list"
set selectRs=conn.Execute(selectSql)
%>
<script language="javascript">
submax=new Array();
var onecount;
onecount=0;
<%
set selecttwonRs=Server.CreateObject("adodb.recordset")
selecttwonSql="select* from town_list"
set selecttwonRs=conn.Execute(selecttwonSql)
i=0
while selecttwonRs.eof=false
%>
submax[<%=i%>]=new Array("<%= trim(selecttwonRs("id"))%>","<%= selecttwonRs("town")%>","<%= selecttwonRs("ik")%>");
<%
i=i+1
selecttwonRs.movenext
wend
%>
onecount=<%=i%>
function ActionFrom(Acity)
{
document.ActionCity.button1.value=Acity;
var a=Acity;
var ii;
for (ii=0;ii< onecount; ii++)
{
if (submax[ii][2] == a)
{
document.ActionCity.select3.options[document.ActionCity.select3.length] = new Option(submax[ii][1], submax[ii][0]);
}
}
}
</script>
<BODY>
<form name="ActionCity" method="post" action="">
<table width="547" height="85" border="1">
<tr>
<td width="56">省/地区</td>
<td width="86"><select name="select2" id="select2" onChange="ActionFrom(document.ActionCity.select2.options[document.ActionCity.select2.selectedIndex].value)">
<option value="">请选择</option>
<%
while selectRs.EOF=false
%>
<option value="<%=selectRs("id")%>"><%=selectRs("savetype")%></option>
<%
selectRs.MoveNext
wend
%>
</select></td>
<td width="56">市/县</td>
<td width="179"><select name="select3" id="select3">
<option value="">请选择</option>
</select></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><input type="submit" name="button1" id="button" value="提交"></td>
<td> </td>
<td> </td>
</tr>
</table>
</form>
</BODY>
</HTML>