| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 517 人关注过本帖
标题:三级连动菜单问题
只看楼主 加入收藏
tyang
Rank: 1
等 级:新手上路
帖 子:216
专家分:0
注 册:2004-9-16
收藏
 问题点数:0 回复次数:1 
三级连动菜单问题

<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
sql = "select * from district order by districtid asc"
set rs = conn.execute(sql)
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("districtname"))%>","<%= trim(rs("locationid"))%>","<%= trim(rs("districtid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;

function changelocation(districtid)
{
document.myform.districtname.length = 0;

var districtid=districtid;
var i;
document.myform.districtname.options[0] = new Option('==所选城市的地区==','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == districtid)
{
document.myform.districtname.options[document.myform.districtname.length] = new Option(subcat[i][0], subcat[i][2]);
}
}

}
</script>


<%sql2 = "select * from village order by villageid asc"
set rs2 = conn.execute(sql2)
%>
<script language = "JavaScript">
var onecount2;
onecount2=0;
subcat2 = new Array();
<%
count2 = 0
do while not rs2.eof
%>
subcat2[<%=count2%>] = new Array("<%= trim(rs2("villagename"))%>","<%= trim(rs2("districtid"))%>","<%= trim(rs2("villageid"))%>");
<%
count2 = count2 + 1
rs2.movenext
loop
rs2.close
set rs2=nothing
%>
onecount2=<%=count2%>;

function changelocation2(villageid)
{
document.myform.village.length = 0;

var villageid=villageid;
var j;
document.myform.village.options[0] = new Option('==所选地区的县区==','');
for (j=0;j < onecount2; j++)
{
if (subcat2[j][1] == villageid)
{
document.myform.village.options[document.myform.village.length] = new Option(subcat2[j][0], subcat2[j][2]);
}
}

}
</script>

</head>
<body>
<form name="myform" method="post">
题目:<input type="text" name="T2" size="20"><br>
来源:<input type="text" name="T3" size="20"><br>
分类:<select name="biglocation" onChange="changelocation(document.myform.biglocation.options[document.myform.biglocation.selectedIndex].value)" size="1">
<option selected>请选择你所在的省份</option>
<%

sql1 = "select * from location order by locationid asc"
set rs1 = conn.Execute (sql1)
do while not rs1.eof
%>
<option value="<%=trim(rs1("locationid"))%>"><%=trim(rs1("locationname"))%></option>

<%
rs1.movenext
loop
rs1.close
set rs1 = nothing
conn.Close
set conn = nothing
%>
</select>

<select name="smalllocation" onChange="changelocation2(document.myform.smalllocation.options[document.myform.smalllocation.selectedIndex].value)">
<option selected value="">==所有地区==</option>
</select>

<select name="village" size="1">
<option selected>==所有县区==</option>
</select>
<br>
关键词:<input type="text" name="T4" size="20"><br>
内容:<textarea rows="9" name="S1" cols="51"></textarea>
</form>

</body>
</html>
为什么上面的代码运行没有反应!

搜索更多相关主题的帖子: 菜单 连动 
2006-07-23 19:12
tyang
Rank: 1
等 级:新手上路
帖 子:216
专家分:0
注 册:2004-9-16
收藏
得分:0 

怎么没有人帮忙呀!


我的网站" target="_blank">http://www. 欢迎加入网站设计交流群:17222128
2006-07-24 08:42
快速回复:三级连动菜单问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026531 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved