二级联动问题……找高手解决!

john25308771026 2010-07-06 02:48:26
我刚开始学习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>
...全文
29 点赞 收藏 1
写回复
1 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
msadmzz 2011-11-28
网上有一些JQuery控件,可以直接使用,你在GOOGLE上搜一下。
回复
发动态
发帖子
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
社区公告
暂无公告