JS脚本:
<%
dim rs
dim sql
dim count
dim rs1
dim sql1
sql = "select * from region order by zoneid asc"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,3
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("regionname"))%>","<%= trim(rs("zoneid"))%>","<%= trim(rs("regionid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;
function changelocation(zoneid)
{
document.myform.region.length = 0;
var zoneid=zoneid;
var i;
document.myform.region.options[0] = new Option('--地区--','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == zoneid)
{
document.myform.region.options[document.myform.region.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
表单内容:
<table>
<form>
<tr>
<td>
<span class="STYLE1">*</span> 大区:
<select name="zone" size="1" id="zone" onChange="changelocation(document.myform.zone.options[document.myform.zone.selectedIndex].value)">
<option value=0 selected >请选择</option>
<%
sql1 = "select * from bigzone order by zonename asc"
set rs1 = server.createobject("adodb.recordset")
rs1.open sql1,conn,1,3
%>
<%while not rs1.eof%>
<option value="<%=rs1("zoneid")%>"><%=rs1("zonename")%></option>
<%rs1.movenext
wend
rs1.close
set rs1 = nothing
%>
</select> </td>
<td width="20%"><span class="STYLE1">*</span>地区:
<select name="region" size="1" id="region" >
<option value=0 selected >请选择</option>
</select>
</tr>
</form>
</table>
<%
dim rs
dim sql
dim count
dim rs1
dim sql1
sql = "select * from region order by zoneid asc"
set rs = server.createobject("adodb.recordset")
rs.open sql,conn,1,3
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("regionname"))%>","<%= trim(rs("zoneid"))%>","<%= trim(rs("regionid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;
function changelocation(zoneid)
{
document.myform.region.length = 0;
var zoneid=zoneid;
var i;
document.myform.region.options[0] = new Option('--地区--','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == zoneid)
{
document.myform.region.options[document.myform.region.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
表单内容:
<table>
<form>
<tr>
<td>
<span class="STYLE1">*</span> 大区:
<select name="zone" size="1" id="zone" onChange="changelocation(document.myform.zone.options[document.myform.zone.selectedIndex].value)">
<option value=0 selected >请选择</option>
<%
sql1 = "select * from bigzone order by zonename asc"
set rs1 = server.createobject("adodb.recordset")
rs1.open sql1,conn,1,3
%>
<%while not rs1.eof%>
<option value="<%=rs1("zoneid")%>"><%=rs1("zonename")%></option>
<%rs1.movenext
wend
rs1.close
set rs1 = nothing
%>
</select> </td>
<td width="20%"><span class="STYLE1">*</span>地区:
<select name="region" size="1" id="region" >
<option value=0 selected >请选择</option>
</select>
</tr>
</form>
</table>
标签:
asp动态级联菜单代码
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“asp动态级联菜单代码”评论...