ASP二级联动 错在哪儿了?
<%dimconndimconnstronerrorresumenextconnstr="DBQ="+server.MapPath("mofei.mdb")+";Defa...
<%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.MapPath("mofei.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.CreateObject("ADODB.CONNECTION")
conn.open connstr
%>
<script language = "JavaScript">
sall=new Array();
<%
Dim i
i=0
set rs=conn.execute("select * from subject")
do while not rs.eof
%>
sall[<%=i%>]=new Array("<%=rs("subjectname")%>","<%=rs("departid")%>","<%=rs("subjectid")%>");
<%
i=i+1
rs.movenext
loop
rs.close
%>
function changeselect(selvalue)
{
document.myform.Nclassid.length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[1]==selvalue)
{
var newOption1=new Option(sall[0],sall[2]);
document.all.Nclassid.add(newOption1);
}
}
}
</script>
<form method="post" name="myform" action="ru_query.asp">
<select name="classid" onChange="changeselect(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="">省</option>
<%
set rs1=conn.execute("select * from depart")
do while not rs1.eof
response.write "<option value='"&rs1("departid")&"'>"&rs1("departname")&"</option>"&chr(13)+chr(10)
rs1.movenext
loop
rs1.close
%>
</select>
<select name="Nclassid">
<option selected value="">市</option>
</select>
只能显示省,不能显示市 展开
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.MapPath("mofei.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.CreateObject("ADODB.CONNECTION")
conn.open connstr
%>
<script language = "JavaScript">
sall=new Array();
<%
Dim i
i=0
set rs=conn.execute("select * from subject")
do while not rs.eof
%>
sall[<%=i%>]=new Array("<%=rs("subjectname")%>","<%=rs("departid")%>","<%=rs("subjectid")%>");
<%
i=i+1
rs.movenext
loop
rs.close
%>
function changeselect(selvalue)
{
document.myform.Nclassid.length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[1]==selvalue)
{
var newOption1=new Option(sall[0],sall[2]);
document.all.Nclassid.add(newOption1);
}
}
}
</script>
<form method="post" name="myform" action="ru_query.asp">
<select name="classid" onChange="changeselect(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="">省</option>
<%
set rs1=conn.execute("select * from depart")
do while not rs1.eof
response.write "<option value='"&rs1("departid")&"'>"&rs1("departname")&"</option>"&chr(13)+chr(10)
rs1.movenext
loop
rs1.close
%>
</select>
<select name="Nclassid">
<option selected value="">市</option>
</select>
只能显示省,不能显示市 展开
展开全部
你把函数改成这样试试
function changeselect(selvalue)
{
document.myform.Nclassid.length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[i][1]==selvalue)
{
document.myform.Nclassid.options.add(new Option(sall[i][0],sall[i][2]))
}
}
function changeselect(selvalue)
{
document.myform.Nclassid.length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[i][1]==selvalue)
{
document.myform.Nclassid.options.add(new Option(sall[i][0],sall[i][2]))
}
}
Storm代理
2023-08-29 广告
2023-08-29 广告
"StormProxies是全球大数据IP资源服务商,其住宅代理网络由真实的家庭住宅IP组成,可为企业或个人提供满足各种场景的代理产品。点击免费测试(注册即送1G流量)StormProxies有哪些优势?1、IP+端口提取形式,不限带宽,I...
点击进入详情页
本回答由Storm代理提供
展开全部
function changeselect(selvalue)
{
document.myform.Nclassid.length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[1]==selvalue)
{
var newOption1=new Option(sall[0],sall[2]);
document.all.Nclassid.add(newOption1); <----把all改成myform试一下,因为你的Nclassid是市的下拉列表,在myform里
}
}
}
{
document.myform.Nclassid.length=0;
var selvalue=selvalue;
var i;
for(i=0;i<sall.length;i++)
{
if(sall[1]==selvalue)
{
var newOption1=new Option(sall[0],sall[2]);
document.all.Nclassid.add(newOption1); <----把all改成myform试一下,因为你的Nclassid是市的下拉列表,在myform里
}
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
name="Nclassid">
<option selected value="">
<option selected value="">
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询