关于select级连问题?
为什么我的下拉框只能显示一级的内容,二级的内容不能显示呢,请指点,谢谢!
<%
dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from subcate order by subcateid ",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("subcate"))%>","<%= rs("categoryid")%>","<%= rs("subcateid")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.subcateid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.subcateid.options[document.myform.subcateid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
//-->
</script>
<%
set rs=server.createobject("adodb.recordset")
rs.open " select * from category order by categoryid ",conn,1,1
if rs.eof and rs.bof then
response.write "请先添加商品大类。"
response.end
else
%>
<SELECT name="categoryid" onChange="changelocation(document.myform.categoryid.options[document.myform.categoryid.selectedIndex].value)" size="1">
<option selected value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option>
<%
dim selclass
selclass=rs("categoryid")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("categoryid")%>"><%=trim(rs("category"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
<font color="#000000" size="2">小类:</font>
<select name="subcatesid">
<%rs.open "select * from subcate where categoryid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("subcateid")%>"><%=rs("subcate")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("subcateid")%>"><%=rs("subcate")%></option>
<% rs.movenext
loop
end if
rs.close
set rs = nothing
conn.Close
set conn = nothing
%>
</select>