asp+数据库的3几连动菜单

谁有AJAX的具体代码贴出来看一下,如果有打包下载就更好了... 谁有AJAX的具体代码贴出来看一下,如果有打包下载就更好了 展开
 我来答
百度网友879e646bf
2006-12-06 · 超过17用户采纳过TA的回答
知道答主
回答量:79
采纳率:0%
帮助的人:0
展开全部
三级连动的下拉框(数据库版)--吐血推荐
三级下拉框连动

‘数据库:
‘location
‘表1 loaction 所在地表
‘ 字段
‘ loactionid
‘ loactionname 名字
‘表2 district 所在的地区表
‘ 字段
‘ locationid
‘ districtid
‘ districtname
‘表3 village 所在的县区表
‘ 字段
‘ districtid
‘ villageid
‘ villagename

<%Option Explicit%>
<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<%
dim conn
dim rs
dim sql
dim count
dim rs1
dim sql1
dim rs2
dim sql2
dim count2

set conn=server.createobject("adodb.connection")
conn.open"provider=sqloledb;data source=192.168.0.33;uid=sa;pwd=;database=location;"

sql = "select * from district order by locationid 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(locationid)
{
document.myform.smalllocation.length = 0;

var locationid=locationid;
var i;
document.myform.smalllocation.options<0> = new Option(‘==所选城市的地区==‘,‘‘);
for (i=0;i < onecount; i++)
{
if (subcat<1> == locationid)
{
document.myform.smalllocation.options = new Option(subcat<0>, subcat<2>);
}
}

}
</script>

<%sql2 = "select * from village order by districtid 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<1> == villageid)
{
document.myform.village.options = new Option(subcat2<0>, subcat2<2>);
}
}

}
</script>

</head>
<body>
<form name="myform" method="post">
题目:<input type="text" name="T2" size="20">

来源:<input type="text" name="T3" size="20">

分类:<select name="biglocation" onChange="changelocation(document.myform.biglocation.options.value)" size="1">
<option selected>请选择你所在的省份</option>
<%

sql1 = "select * from location order by locationname 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.value)">
<option selected value="">==所有地区==</option>
</select><select name="village" size="1">
<option selected>==所有县区==</option>
</select>

关键词:<input type="text" name="T4" size="20">

内容:<textarea rows="9" name="S1" cols="51"></textarea>
</form>

</body>
</html>
htc10
2006-12-06 · 超过55用户采纳过TA的回答
知道小有建树答主
回答量:216
采纳率:50%
帮助的人:120万
展开全部
我都是用ajax做联动菜单的 ajax写的可以联无数级

具体代码也讲不清楚
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式