ASP二级联动菜单
<html><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"><title>无...
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%set conn=Server.Createobject("adodb.connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;"& _
"Data Source=" & Server.MapPath("text.mdb")
%>
<script language = "JavaScript">
sall=new Array();
<%
set rs = Server.CreateObject("adodb.recordset")
sql="select * from subject "
rs.open sql, conn,1,3
if not (rs.bof or rs.eof) then
do while not rs.eof
%>
sall[<%=i%>]=new Array("<%=rs("subjectID")%>","<%=rs("departID")%>","<%=rs("subjectName")%>");
<%
i=i+1
rs.movenext
loop
rs.close
set rs=nothing
end if
%>
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)
{
//var newOption1=new Option(sall[i][0],sall[i][2]);
//document.all.Nclassid.add(newOption1);
document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(sall[i][0], sall[i][2]);
}}}</script>
<form method="post" name="myform" action="">
<select name="classid" onChange="changeselect(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="">未指定条件</option>
<%
set rs1 = Server.CreateObject("adodb.recordset")
sql="select * from depart order by departID desc"
rs1.open sql, conn,1,3
if not (rs1.eof or rs1.bof) then
do while not rs1.eof
%>
<option value=<%=rs1("departID")%>><%=rs1("departName")%></option>
<%
rs1.movenext
loop
rs1.close
end if%>
</select>
<select name="Nclassid" >
<option selected value="">未指定</option>
</select>
</form>
</body>
</html>
为什么以上程序运行不了
呵呵解决了
i=0
忘写了 展开
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<%set conn=Server.Createobject("adodb.connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;"& _
"Data Source=" & Server.MapPath("text.mdb")
%>
<script language = "JavaScript">
sall=new Array();
<%
set rs = Server.CreateObject("adodb.recordset")
sql="select * from subject "
rs.open sql, conn,1,3
if not (rs.bof or rs.eof) then
do while not rs.eof
%>
sall[<%=i%>]=new Array("<%=rs("subjectID")%>","<%=rs("departID")%>","<%=rs("subjectName")%>");
<%
i=i+1
rs.movenext
loop
rs.close
set rs=nothing
end if
%>
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)
{
//var newOption1=new Option(sall[i][0],sall[i][2]);
//document.all.Nclassid.add(newOption1);
document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(sall[i][0], sall[i][2]);
}}}</script>
<form method="post" name="myform" action="">
<select name="classid" onChange="changeselect(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="">未指定条件</option>
<%
set rs1 = Server.CreateObject("adodb.recordset")
sql="select * from depart order by departID desc"
rs1.open sql, conn,1,3
if not (rs1.eof or rs1.bof) then
do while not rs1.eof
%>
<option value=<%=rs1("departID")%>><%=rs1("departName")%></option>
<%
rs1.movenext
loop
rs1.close
end if%>
</select>
<select name="Nclassid" >
<option selected value="">未指定</option>
</select>
</form>
</body>
</html>
为什么以上程序运行不了
呵呵解决了
i=0
忘写了 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询