级连菜单的问题,高手请帮忙看看. ( 积分: 30 )

H

haoshan

Unregistered / Unconfirmed
GUEST, unregistred user!
找了半天也不知哪的错,请大家帮忙看一下.
html文件和数据库如下:
<html>
<head>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html;
charset=gb2312&quot;>
<meta name=&quot;GENERATOR&quot;
content=&quot;Microsoft FrontPage 4.0&quot;>
<meta name=&quot;ProgId&quot;
content=&quot;FrontPage.Editor.Document&quot;>
<title>多级关联菜单数据库版</title>
</head>
<body>
<form name=&quot;frm&quot;>
<select name=school onchange=&quot;MulSelect(1)&quot;></select>
<select name=department onchange=&quot;MulSelect(2)&quot;></select>
<select name=grade onchange=&quot;MulSelect(3)&quot;></select>
<select name=student></select>
</form>
<script>
var arrSel=[&quot;school&quot;,&quot;department&quot;,&quot;grade&quot;,&quot;student&quot;]
arrData=[];

<%
dim conn,rs
set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;
&amp;
Server.MapPath(&quot;test.mdb&quot;)
set rs=conn.execute(&quot;select * from dbselect&quot;)
do while not rs.eof
%>
arrData[arrData.length]=[&quot;<%=trim(rs(&quot;school&quot;))%>&quot;,&quot;<%=trim(rs(&quot;department&quot;))%>&quot;,&quot;<%=trim(rs(&quot;grade&quot;))%>&quot;,&quot;<%=trim(rs(&quot;student&quot;))%>&quot;]
arrdata.length=arrdata.length+1
<%
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</script>
<script>
function MulSelect(num){
var find=false
var i,j,arrTemp=[];

for(i=0;i<num;i++){arrTemp=eval(&quot;document.frm.&quot;+arrSel).value}
if(num<arrSel.length)
with(eval(&quot;document.frm.&quot;+arrSel[num])){
length=0
for(i=0;i<arrData.length;i++){
for(j=0;j<num;j++)if(arrTemp[j]!=arrData[j])break;

if(j!=num)continue;

if(length==0 &amp;brvbar;
&amp;brvbar;options[length-1].text!=arrData[num]){
for(m=0;m<options.length;m++)if(options[m].text==arrData[num])find=true
if(!find)options[options.length]=new Option(arrData[num],arrData[num])
}
}
MulSelect((num+1))
}
}
MulSelect(0)
</script>
</body>
</html>
test数据库中包含这几个表:
dbselect
id school department grade student
1 一中 初中部 一年级 李里
2 一中 初中部 二年级 王里
3 一中 初中部 二年级 李立
4 一中 高中部 一年级 刘名
5 一中 高中部 一年级 马立
6 一中 高中部 二年级 刘六
7 二中 初中部 一年级 孙名
8 二中 高中部 一年级 张娜
9 二中 高中部 一年级 刘伟
big_class
big_class_id big_class_name
1 一年级
2 二年级
3 三年级
4 四年级
5 五年级
small_class:
small_class_id small_class_name belongto_big_class
1 一一班 1
2 一二班 1
3 一三班 1
4 一四班 1
5 二一班 2
6 二二班 2
7 二三班 2
8 三一班 3
9 三二班 3
10 三三班 3
11 四一班 4
12 四二班 4
13 五一班 5
14 五二班 5
 
找了半天也不知哪的错,请大家帮忙看一下.
html文件和数据库如下:
<html>
<head>
<meta http-equiv=&quot;Content-Type&quot;
content=&quot;text/html;
charset=gb2312&quot;>
<meta name=&quot;GENERATOR&quot;
content=&quot;Microsoft FrontPage 4.0&quot;>
<meta name=&quot;ProgId&quot;
content=&quot;FrontPage.Editor.Document&quot;>
<title>多级关联菜单数据库版</title>
</head>
<body>
<form name=&quot;frm&quot;>
<select name=school onchange=&quot;MulSelect(1)&quot;></select>
<select name=department onchange=&quot;MulSelect(2)&quot;></select>
<select name=grade onchange=&quot;MulSelect(3)&quot;></select>
<select name=student></select>
</form>
<script>
var arrSel=[&quot;school&quot;,&quot;department&quot;,&quot;grade&quot;,&quot;student&quot;]
arrData=[];

<%
dim conn,rs
set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot;
&amp;
Server.MapPath(&quot;test.mdb&quot;)
set rs=conn.execute(&quot;select * from dbselect&quot;)
do while not rs.eof
%>
arrData[arrData.length]=[&quot;<%=trim(rs(&quot;school&quot;))%>&quot;,&quot;<%=trim(rs(&quot;department&quot;))%>&quot;,&quot;<%=trim(rs(&quot;grade&quot;))%>&quot;,&quot;<%=trim(rs(&quot;student&quot;))%>&quot;]
arrdata.length=arrdata.length+1
<%
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</script>
<script>
function MulSelect(num){
var find=false
var i,j,arrTemp=[];

for(i=0;i<num;i++){arrTemp=eval(&quot;document.frm.&quot;+arrSel).value}
if(num<arrSel.length)
with(eval(&quot;document.frm.&quot;+arrSel[num])){
length=0
for(i=0;i<arrData.length;i++){
for(j=0;j<num;j++)if(arrTemp[j]!=arrData[j])break;

if(j!=num)continue;

if(length==0 &amp;brvbar;
&amp;brvbar;options[length-1].text!=arrData[num]){
for(m=0;m<options.length;m++)if(options[m].text==arrData[num])find=true
if(!find)options[options.length]=new Option(arrData[num],arrData[num])
}
}
MulSelect((num+1))
}
}
MulSelect(0)
</script>
</body>
</html>
test数据库中包含这几个表:
dbselect
id school department grade student
1 一中 初中部 一年级 李里
2 一中 初中部 二年级 王里
3 一中 初中部 二年级 李立
4 一中 高中部 一年级 刘名
5 一中 高中部 一年级 马立
6 一中 高中部 二年级 刘六
7 二中 初中部 一年级 孙名
8 二中 高中部 一年级 张娜
9 二中 高中部 一年级 刘伟
big_class
big_class_id big_class_name
1 一年级
2 二年级
3 三年级
4 四年级
5 五年级
small_class:
small_class_id small_class_name belongto_big_class
1 一一班 1
2 一二班 1
3 一三班 1
4 一四班 1
5 二一班 2
6 二二班 2
7 二三班 2
8 三一班 3
9 三二班 3
10 三三班 3
11 四一班 4
12 四二班 4
13 五一班 5
14 五二班 5
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
731
import
I
I
回复
0
查看
708
import
I
I
回复
0
查看
709
import
I
顶部