asp 分类下关键字搜索
单独的关键字搜索可以实现,但是当选择类别的时候搜索的结果和没选类别一样,请问该怎么解决,以下是原代码.谢谢--------------------------------...
单独的关键字搜索可以实现,但是当选择类别的时候搜索的结果和没选类别一样,请问该怎么解决,以下是原代码.谢谢
-------------------------------------------------------------------------------------------------------
<%
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from Bnclass order by ordernum asc,nclassid asc"
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("Nclassname"))%>","<%= trim(rs("classid"))%>","<%= trim(rs("Nclassid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.Nclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
<%
sql = "select * from Bclass order by ordernum asc,classid asc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
response.end
else
%>
<select name="classid" onChange="changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="0">=请选择大类=</option>
<%
do while not rs.eof
%>
<option value="<%=trim(rs("classid"))%>"><%=trim(rs("classname"))%></option>
<%
rs.movenext
loop
end if
rs.close
set rs = nothing
%>
</select>
<select name="Nclassid">
<option selected value="0">=请选择小类=</option>
</select>
<input type='text' name='keyword' size='15' value='<%=Request.Form("keyword")%>' />
<input type='submit' value='搜索' name="submit" /> 展开
-------------------------------------------------------------------------------------------------------
<%
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from Bnclass order by ordernum asc,nclassid asc"
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("Nclassname"))%>","<%= trim(rs("classid"))%>","<%= trim(rs("Nclassid"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.Nclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.Nclassid.options[document.myform.Nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
}
</SCRIPT>
<%
sql = "select * from Bclass order by ordernum asc,classid asc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
response.end
else
%>
<select name="classid" onChange="changelocation(document.myform.classid.options[document.myform.classid.selectedIndex].value)" size="1">
<option selected value="0">=请选择大类=</option>
<%
do while not rs.eof
%>
<option value="<%=trim(rs("classid"))%>"><%=trim(rs("classname"))%></option>
<%
rs.movenext
loop
end if
rs.close
set rs = nothing
%>
</select>
<select name="Nclassid">
<option selected value="0">=请选择小类=</option>
</select>
<input type='text' name='keyword' size='15' value='<%=Request.Form("keyword")%>' />
<input type='submit' value='搜索' name="submit" /> 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询