数据库更新级联菜单的问题,怎么样从下拉列表获得的value或者text中取数据进行查询?(解决就送分) http://sz.luohuedu.net/xml/exam/multiselect.asp源代码请发mail 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你传时候用onchange="change_java(this.value)" 将当前选中的值传到一个函数中,搜索下一级的列表,找到以后付给一个数组,然后再用你的下拉列表构建函数! 就是这个,其中的left呀right函数都不能用,警告什么非法操作,不知道为什么<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 count2dim mycount1dim mycount2 %><%set conn=server.createobject("ADODB.connection")cnnstring="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("district_code.mdb") conn.open cnnstringsql = "select * from 行政区划代码 order by code_name" 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("code_name"))%>");<% count = count + 1 rs.movenext loop rs.close set rs=nothing %> onecount=<%=count%>; function changelocation0(locationid) { document.myform.smalllocation.length = 0; var locationid1=locationid;var condition1=locationid1.left(2);var i; var subsub=new array();mycount1=0;document.myform.smalllocation.options[0] = new Option('==市==','');for(i=0;i<onecount-1;i++){ number2=new string(locationid); number=new String(subcat[i]); number1=number.left(6); number1=number1.right(2); if((number.left(2)==number2.left(2))&&(number1=='00')) { mycount1=mycount1+1; subsub=array(subcat[i]); document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i],subcat[i]); }} }function changelocation(locationid) { var abc=new string(locationid) alert(abc.substr(0,6)) }</script> <script language=javascript>function changelocation2(villageid) {document.myform.village.length = 0; var villageid1=villageid; var j; document.myform.village.options[0] = new Option('==所选地区的县区==',''); for (j=0;j <mycount1-1; j++) { var number1=new string(subsub[i]); var number2=new string(villageid); sth1=number1.substr(0,4); sth2=number2.substr(0,4); if(sth1==sth2) { document.myform.village.options[document.myform.village.length] = new Option(subsub[i],subsub[i]); }} }</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[document.myform.biglocation.selectedIndex].text)" size="1"> <option selected>请选择省份</option> <% sql1 = "select * from 行政区划代码 where code_name like '%0000%' order by code_name asc" set rs1 = conn.Execute (sql1) do while not rs1.eof %> <option value="<%=trim(rs1("code_name"))%>"><%=trim(rs1("code_name"))%></option> <% rs1.movenext loop rs1.close set rs1 = nothing %> </select><select name="smalllocation" onChange="changelocation2(document.myform.smalllocation.options[document.myform.smalllocation.selectedIndex].text)"> <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> js异步问题,循环遍历执行一个带弹出框的函数,求指导 框架显示和传值的问题,有难度,进来看看! jquery 折叠问题,就是鼠标滑过,改变类名 问个js控制图片滚动问题 jsp程序 求一个JS函数,能将格式字符串2010-1-5为2010-01-05 菜鸟提问 数据库存入的HTML标签 如何还原显示出来 求一js 请问一下各位高程? 急求大神指点,如何实现滑动条,将数值传递给input,谢谢! 动态加载js文件! 对话框的问题,有兴趣的朋友请进
<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
dim mycount1
dim mycount2 %>
<%set conn=server.createobject("ADODB.connection")
cnnstring="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath("district_code.mdb")
conn.open cnnstringsql = "select * from 行政区划代码 order by code_name"
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("code_name"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;
function changelocation0(locationid)
{
document.myform.smalllocation.length = 0; var locationid1=locationid;
var condition1=locationid1.left(2);
var i;
var subsub=new array();
mycount1=0;
document.myform.smalllocation.options[0] = new Option('==市==','');
for(i=0;i<onecount-1;i++)
{
number2=new string(locationid);
number=new String(subcat[i]);
number1=number.left(6);
number1=number1.right(2);
if((number.left(2)==number2.left(2))&&(number1=='00'))
{
mycount1=mycount1+1;
subsub=array(subcat[i]);
document.myform.smalllocation.options[document.myform.smalllocation.length] = new Option(subcat[i],subcat[i]);
}
}
}
function changelocation(locationid)
{
var abc=new string(locationid)
alert(abc.substr(0,6))
}
</script> <script language=javascript>
function changelocation2(villageid)
{
document.myform.village.length = 0;
var villageid1=villageid; var j;
document.myform.village.options[0] = new Option('==所选地区的县区==','');
for (j=0;j <mycount1-1; j++)
{
var number1=new string(subsub[i]);
var number2=new string(villageid);
sth1=number1.substr(0,4);
sth2=number2.substr(0,4);
if(sth1==sth2)
{
document.myform.village.options[document.myform.village.length] = new Option(subsub[i],subsub[i]);
}
}
}
</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[document.myform.biglocation.selectedIndex].text)" size="1">
<option selected>请选择省份</option>
<% sql1 = "select * from 行政区划代码 where code_name like '%0000%' order by code_name asc"
set rs1 = conn.Execute (sql1)
do while not rs1.eof
%>
<option value="<%=trim(rs1("code_name"))%>"><%=trim(rs1("code_name"))%></option> <%
rs1.movenext
loop
rs1.close
set rs1 = nothing
%>
</select><select name="smalllocation" onChange="changelocation2(document.myform.smalllocation.options[document.myform.smalllocation.selectedIndex].text)">
<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>