[求助]两个select下拉菜单传值的问题
department表:depart_id depart_name
1 计算机系
2 外语系
... ...
class表:
class_id class_name depart_id
1 网络 1
2 软件 1
3 旅游英语 2
4 商务英语 2
5 涉外文秘 2
... ... ...
代码部分:
<!--#include file="conn.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from class"
rs.open sql,conn,1,1
%>
<SCRIPT language="JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("class_name"))%>","<%= trim(rs("depart_id"))%>","<%= trim(rs("class_id"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.form1.class.length = 0;
var id=locationid
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.class.options[document.form1.class.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
<body>
<p align="center"><font size="5"><strong>教师注册信息</strong></font></p>
<form name="form1" method="post" action="">
<table width="370" height="200" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000" >
<%
set rd=server.CreateObject("adodb.recordset")
sqll="select * from department"
rd.open sqll,conn,1,1
%>
<tr>
<td width="101" bgcolor="#FFFFFF"><div align="right">系别:</div></td>
<td width="100" bgcolor="#FFFFFF"> <select name="depart" onChange="changelocation(document.form1.depart.options[document.form1.depart.selectedIndex].value)" >
<option value=0>请选择</option>
<%if not rd.eof then
do while not rd.eof%>
<option value="<%=rd("depart_ID")%>"><%=rd("depart_name")%></option>
<%rd.movenext
loop
end if
%>
</select></td>
<td width="50" bgcolor="#FFFFFF"><div align="right">班级:</div></td>
<td width="114" bgcolor="#FFFFFF"> <select name="class" >
<option selected value=0>请选择</option>
</select></td>
</tr>
</table>
</form>
</body>
请高手指点一点,小弟哪里写错了,急!!谢谢