非常感谢!!!!!!!!!!!!!!!!!!我去试了!
感谢!!!!!!!!!
response.write "Yeah!!!you have got 300 points!!!congratulations!!!And you are the god!!!My Christ,I will appreciation you in my life"
<%
'谢谢你的帮助,以下是关于3级联动的代码,我现在正在为获取值而困惑,对你的帮助表示衷心的感谢!
'三级下拉框连动
'
'数据库:
'location
'表1 loaction 所在地表
' 字段
' loactionid
' loactionname 名字
'表2 district 所在的地区表
' 字段
' locationid
' districtid
' districtname
'表3 village 所在的县区表
' 字段
' districtid
' villageid
' villagename
%>
<%Option Explicit%>
<%
Dim strLocationID,strDistrictID,strVillageID
strLocationID = Trim(Request.QueryString("id1"))
strDistrictID = Trim(Request.QueryString("id2"))
strVillageID = Trim(Request.QueryString("id3"))
%>
<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 "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)
{
//when change1 , then change2.
//select2 value=districtid name=districtname
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[i][1] == locationid)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][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)
{
//when change2, then change3
//select3 value=villageidname=villagename
//find districtname form subcat where id=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 language=javascript>
var cityouterHTML = document.form1.city.outerHTML.substr(0, document.form1.city.outerHTML.length-9);
function sheng()
{
var shengName = ["浙江", "江苏", "安徽", "江西"]; //这些数据可以从数据库中取得
var e = document.form1.sheng;
var s = e.outerHTML.substr(0, e.outerHTML.length-9) + "\r\n";
for (var i=0; i<shengName.length; i++){
s += "<option value='"+ shengName[i] +"'>"+ shengName[i] +"</option>\r\n";}
s += "</select>";
e.outerHTML = s;
} sheng();
function cityName(val)
{
var 浙江 = ["杭州", "宁波", "温州", "绍兴", "金华", "湖州"];
var 江苏 = ["南京", "苏州", "无锡", "常州", "镇江", "徐州"];
var 安徽 = ["合肥", "翕县", "黄山", "祁门", "休宁"];
var 江西 = ["南昌", "九江", "赣州", "上饶", "新余", "景德镇"];
//这些数据可以从数据库中取得
var e = document.form1.city;
var s = cityouterHTML;
if (val == "") {s += "</select>"; e.outerHTML = s; return;}
var a = eval(val);
for (var i=0; i<a.length; i++)
{
s += "<option value='"+ a[i] +"'>"+ a[i] +"</option>\r\n";
}
s += "</select>";
e.outerHTML = s;
}
</script>
<%
'谢谢你的帮助,以下是关于3级联动的代码,我现在正在为获取值而困惑,对你的帮助表示衷心的感谢!
'三级下拉框连动
'
'数据库:
'location
'表1 loaction 所在地表
' 字段
' loactionid
' loactionname 名字
'表2 district 所在的地区表
' 字段
' locationid
' districtid
' districtname
'表3 village 所在的县区表
' 字段
' districtid
' villageid
' villagename
%>
<%Option Explicit%>
<%
Dim strLocationID,strDistrictID,strVillageID
strLocationID = Trim(Request.QueryString("id1"))
strDistrictID = Trim(Request.QueryString("id2"))
strVillageID = Trim(Request.QueryString("id3"))
%>
<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 "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)
{
//when change1 , then change2.
//select2 value=districtid name=districtname
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[i][1] == locationid)
{
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i][0], subcat[i][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)
{
//when change2, then change3
//select3 value=villageid name=villagename
//find districtname form subcat where id=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]);
}
}