只有大类,就能显示,不会超时,加了分类就会超时!!应该是 小类 有问题!!大家看看 那里错了!谢谢,急!!!
<%
dim rs
dim count
set rs=server.createobject("adodb.recordset")
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("cpbe_name"))%>","<%= trim(rs("cpbe_id"))%>","<%= trim(rs("cpse_id"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.cpse_id.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.cpse_id.options[document.myform.cpse_id.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
//-->
</script>
<td width="23%" align="right">选择商品的分类:</td>
<td width="77%">
大类:
<%
rs.open "select * from cp_btype order by cpbe_idorder",conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
response.end
else
%>
<select name="cpbe_id" onChange="changelocation(document.myform.cpbe_id.options[document.myform.cpbe_id.selectedIndex].value)">
<option selected value="<%=rs("cpbe_id")%>"><%=trim(rs("cpbe_name"))%></option>
<%
dim selclass
selclass=rs("cpbe_id")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("cpbe_id")%>"><%=trim(rs("cpbe_name"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
小类:
<select name="cpse_id">
<option value="" selected>不指定小类</option>
<%
rs.open "select * from cp_stype where cpbe_id='" & selclass & "'",conn,1,1
if not(rs.eof and rs.bof) then
%>
<option value="<%=rs("cpse_id")%>"><%=rs("cpse_name")%></option>
<% rs.movenext
do while not rs.eof%>
<option value="<%=rs("cpse_id")%>"><%=rs("cpse_name")%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
</td>