两个下拉菜单互动代码有问题,不能互动!
大家仔细帮我看一看到底哪里有问题?
1
2dim rs
3dim sql
4dim count
5set rs=server.createobject("adodb.recordset")
6sql = "select * from _Web_Data_Small_Class order by class_id asc"
7rs.open sql,conn,1,1
1<html xmlns="http://www.w3.org/1999/xhtml">
2<head>
3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
4<title>```
5=SoftName
6```</title>
7<link href="_Include/style.css" rel="stylesheet" type="text/css"/>
8<script language="JavaScript">
9var onecount;
10onecount=0;
11subcat = new Array();
count = 0
do while not rs.eof
1subcat[```
2=count
3```] = new Array("```
4= trim(rs("Small_class"))
5```","```
6= trim(rs("Topic_id"))
7```","```
8= trim(rs("class_id"))
9```");
count = count + 1
rs.movenext
loop
rs.close
1onecount=```
2=count
3```;
4
5function changelocation(locationid)
6{
7document.myform.class_id.length = 0;
8
9var locationid=locationid;
10var i;
11for (i=0;i < onecount; i++)
12{
13if (subcat[i][1] == locationid)
14{
15document.myform.class_id.options[document.myform.class_id.length] = new Option(subcat[i][0], subcat[i][2]);
16}
17}
18
19}
20</script>
21</head>
22<body>
23<table border="0" cellpadding="0" cellspacing="0" width="100%">
24<tr>
25<td width="16%"> </td>
26<td align="right" width="84%"></td>
27</tr>
28<tr>
29<td> </td>
30<td> </td>
31</tr>
32</table>
33<table border="0" cellpadding="0" cellspacing="4" width="100%">
34<form action="_Xwsjgl_Small_Class_AddResult.asp" method="post" name="myform" onsubmit="return CheckData();">
35<tr bgcolor="#FAFAFA">
36<td align="right">大类别预览:</td>
37<td>
sql = "select * from _web_data_Big_class"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
response.end
else
1<select name="classid" onchange="changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
2<option ```"="" selected="" topic_id"))="" value="```
3=trim(rs(">```
4=trim(rs("Big_class"))
5```</option>
dim selclass
selclass=rs("Topic_id")
rs.movenext
do while not rs.eof
1<option ```"="" topic_id"))="" value="```
2=trim(rs(">```
3=trim(rs("Big_class"))
4```</option>
5
rs.movenext
loop
end if
rs.close
1</select>
2</td>
3</tr>
4<tr bgcolor="#FAFAFA">
5<td align="right">小类别预览:</td>
6<td> <select name="Nclassid">
sql="select * from _Web_Data_Small_class where Topic_id="&selclass
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
1<option ```"="" class_id")="" selected="" value="```
2=rs(">```
3=rs("Small_class")
4```</option>
rs.movenext
do while not rs.eof
1<option ```"="" class_id")="" value="```
2=rs(">```
3=rs("Small_class")
4```</option>
rs.movenext
loop
end if
rs.close
set rs = nothing
conn.Close
set conn = nothing
1</select>
2</td>
3</tr>
4<tr bgcolor="#FAFAFA">
5<td align="right" width="31%">用户帐号:</td>
6<td width="69%"><input ```"="" class="form_1" id="Userid" name="Userid" readonly="" size="60" style="color:#666666;background:#f0f0f0" type="text" userid")="" value="```
7=Session("/></td>
8</tr>
9<tr bgcolor="#FAFAFA">
10<td align="right">类型名称:</td>
11<td><input class="form_1" id="DataClass" name="DataClass" size="60" type="text"/></td>
12</tr>
13<tr bgcolor="#FAFAFA">
14<td align="right"> </td>
15<td><font color="#FF0000">注:类型名称最好为四个字!如"工作动态"</font></td>
16</tr>
17<tr bgcolor="#FAFAFA">
18<td align="right"> </td>
19<td> </td>
20</tr>
21
22\---------------------------------------------------------------
23
24<html>
25<head>
26<title></title>
27<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
strScript="<script language="JavaScript">"
strScript=strScript+"var onecount;"
strScript=strScript+"onecount=0;"
strScript=strScript+"subcat = new Array();"
dim rs3,x,Bclass
set rs3=server.createobject("adodb.recordset")
sql="select * from Small_Class"
rs3.open sql,myConn
x=0
do while not rs3.eof
strScript=strScript+"subcat["&x&"] = new Array('"&rs3("Bclass")&"','"&rs3("Aclass")&"');"
rs3.movenext
x=x+1
loop
strScript=strScript+"onecount=150;"
strScript=strScript+"function changelocation(locationid)"
strScript=strScript+"{"
strScript=strScript+" document.myform.smallclass.length = 0;"
strScript=strScript+" var locationid=locationid;"
strScript=strScript+" var i;"
strScript=strScript+" for (i=0;i < onecount; i++)"
strScript=strScript+" {"
strScript=strScript+" if (subcat[i][1] == locationid)"
strScript=strScript+" { "
strScript=strScript+" document.myform.smallclass.options[document.myform.smallclass.length] = new Option(subcat[i][0], subcat[i][2]);"
strScript=strScript+" }}}"
strScript=strScript+"</script>"
Response.Write strScript
rs3.close
1
2</head>
3<body bgcolor="#FFFFFF" leftmargin="0" marginheight="0" marginwidth="0" text="#000000" topmargin="0">
4<table align="center" bgcolor="#c6dfde" border="0" cellpadding="0" cellspacing="0" class="myTable" width="776">
5<tr>
6<td valign="top">
7<div align="center"><br/>
8<font color="#006666"><strong>录 入 信 息</strong></font><br/>
9<br/>
id=Request.QueryString("id")
set rs=server.createobject("adodb.recordset")
sql="select * from product where id='"&id&"'"
rs.open sql,myConn,3,3
1</div>
2<table align="center" border="1" cellpadding="5" cellspacing="0" class="L15" height="95%" width="100%">
3<form action="" method="post" name="myform">
4<tr>
5<td colspan="2"> <div align="center">产 品 编 号:
6<input ```"="" id="bh2" name="bh" pid")="" size="10" type="text" value="```
7=rs("/>
8一 级 分类:
9<select id="select" name="bigclass" onchange="changelocation(document.myform.bigclass.options[document.myform.bigclass.selectedIndex].value)">
10<option ```"="" big_class")="" selected="" value="```
11=rs(">```
12=rs("Big_Class")
13```</option>
set rs1=server.createobject("adodb.recordset")
sql="select * from Big_Class order by Big_ClassID asc"
rs1.open sql,myConn,3,3
if rs1.eof then
1<option value="">没有其他分类</option>
else
rs1.movenext
do while not rs1.eof
1<option ```"="" aclass")="" value="```
2=rs1(">```
3=rs1("Aclass")
4```</option>
rs1.movenext
loop
rs1.close
end if
1</select>
2二 级分 类:
3<select id="select2" name="smallclass">
4<option ```"="" selected="" small_class")="" value="```
5=rs(">```
6=rs("Small_Class")
7```</option>
8</select>
9</div></td>
10</tr>
11</form></table>
12</td></tr></table></body>
13</html></form></table></body></html>