不知哪里出了问题,第二个小类没有读出值来,高手帮忙看一下哪里出了问题,先谢了(Clas_1为大类表名,Class_2为小类表名,Sort为大类表的大类字段名,Typename为小类表的小类字段名)
<% call ShowSearch(1) %>
<% sub ShowSearch(ShowType)
dim count
if ShowType<>1 and ShowType<>2 then
ShowType=1
end if
set rs=server.createobject("adodb.recordset")
sql = "select * from Class_2 order by Typeid asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("Typename"))%>","<%= trim(rs("SortId"))%>","<%= trim(rs("Typename"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.Typename.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.Typename.options[document.myform.Typename.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</script>
<table border="0" cellpadding="2" cellspacing="0" align="center">
<form method="Get" name="myform" action="search.asp">
<tr><td height="28">
<%if ShowType=1 then%>
</td>
<td height="28">
<%end if%>
<select name="Sort" onChange="changelocation(document.myform.Sort.options[document.myform.Sort.selectedIndex].value)" size="1">
<option selected value="">所有大类</option>
<%
sqlBigClass="select * from Class_1 order by SortID"
Set rsBigClass= Server.CreateObject("ADODB.Recordset")
rsBigClass.open sqlBigClass,conn,1,1%>
<%
if not (rsBigClass.bof and rsBigClass.eof) then
rsBigClass.movefirst
do while not rsBigClass.eof
response.Write "<option value='" & trim(rsBigClass("Sort")) & "'>" & trim(rsBigClass("Sort")) & "</option>"
rsBigClass.movenext
loop
end if
%>
</select>
<%if ShowType=1 then%>
</td>
<td height="28">
<%end if%>
<select name="Typename">
<option selected value="">所有小类</option>
</select>
<%if ShowType=1 then%>
</td>
<td height="28">
<%end if%>
<input type="text" name="keyword" size=40 value="关键字" maxlength="50" onFocus="this.select();">
<input name="imageField" type="image" src="images/serch.gif" align="top" width="65" height="22" border="0">
</td></tr>
</form>
</table>
<%
end sub
%></TD>
</FORM>
[此贴子已经被作者于2006-7-7 9:58:04编辑过]