<table border="0" cellpadding="0" cellspacing="0">
<form name="myform" action="sp_recarchresult.asp" method="post">
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from pp order by pp_id ",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("pp_name"))%>","<%= rs("pp_lbid")%>","<%= rs("pp_belongsortid")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.myform.sj.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][2] == locationid)
{
document.myform.sj.options[document.myform.sj.length] = new Option(subcat[i][0], subcat[i][1]);
}
}
}
//-->
</script>
<tr>
<td width="118" valign="middle" nowrap="nowrap"><img src="image/woyaozhao.gif" width="117" height="39" /></td>
<td width="571" valign="middle" nowrap="nowrap"> 类别:
<%
rs.open "select * from sort order by order_id",conn,1,1
if rs.eof and rs.bof then
response.write "请先选择类别。"
response.end
else
%>
<select name="dl" size="1" id="dl" onChange="changelocation(document.myform.dl.options[document.myform.dl.selectedIndex].value)">
<option selected value="<%=rs("order_lbid")%>"><%=trim(rs("order_name"))%></option>
<%
dim selclass
selclass=rs("order_lbid")
rs.movenext
do while not rs.eof
%>
<option value="<%=rs("order_lbid")%>"><%=trim(rs("order_name"))%></option>
<%
rs.movenext
loop
end if
rs.close
%>
</select>
商家:
<select name="sj" id="sj">
<%rs.open "select * from pp where pp_belongsortid="&selclass ,conn,1,1
if not(rs.eof and rs.bof) then
%>
<option selected value="<%=rs("pp_lbid")%>"><%=rs("pp_name")%></option>
<% rs.movenext
do while not rs.eof
%>
<option value="<%=rs("pp_lbid")%>"><%=rs("pp_name")%></option>
<% rs.movenext
loop
end if
rs.close
set rs=nothing
%>
</select>
关键字:
<label>
<input name="keyword" type="text" size="20" maxlength="40" />
</label></td>
<td width="97" valign="middle" nowrap="nowrap"><input type="image" src="image/ss.gif" alt="搜索"/></td>
<td width="31" valign="middle"><img src="image/wh.gif" width="22" height="25" /></td>
<td width="52" valign="middle" nowrap="nowrap">如何搜索</td>
</tr>
</form>
</table>
2 处理查询页面代码
<% lb=trim(cint(request("dl")))
sj=trim(cint(request("sj")))
keyword=trim(request("keyword"))
if request("keyword")="" then
sql="select * from product where product_lbid='"&lb&"' and product_belongppid='"&sj&"' order by product_id"
else
sql="select * from product where product_lbid='"&lb&"' and product_belongppid='"&sj&"' and product_name like '%"&keyword&"%' order by product_id"
end if
%>
<table width="917" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan="3" height="33" background="image/tg_pp.jpg"> </td>
</tr>
<tr>
<td width="7" background="image/tg_lb_b0.jpg"> </td>
<td width="899">
<table width="250" height="47" border="1" align="center" cellpadding="9" cellspacing="9" bordercolor="#ffffff" >
<tr >
<%
set rs1=conn.execute("select * from pp where pp_belongsortid='"&lb&"' order by pp_id")
do while not rs1.eof
i=i+1
%>
<td align="center" bordercolor="#CCCCCC"><img src="<%=rs1("pp_imgurl")%>" width="148" height="40" alt="<%=rs1("pp_name")%>"/></td>
<%if i mod 5=0 then%>
</tr>
<% end if
rs1.movenext
loop
rs1.close()
set rs1=nothing
%>
</table>
</td>
<td background="image/tg_lb_b11.jpg" width="8"> </td>
</tr>
<tr>
<td colspan="3"height="23"background="image/tg_b.jpg" > </td>
</tr>
</table>
<table width="917" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="33"background="image/wdcp.jpg"> </td>
</tr>
<tr>
<td background="image/wdcp_xx.jpg" height="29"> </td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2
if rs.eof then
%>
<tr><td align="center" >没有检索到任何产品,请<a href="javascript:history.go(-1)">返回</a></td></tr>
<%else
rowcount=2
rs.pagesize=rowcount
counts=rs.recordcount
totalpage=rs.pagecount
currpage=request.form("page")
if not isnumeric(currpage) then error("<li>错误的Page参数;")
currpage=cINT(currpage)
if currpage<1 then
currpage=1
elseif currpage>totalpage then
currpage=totalpage
end if
rs.absolutepage=currpage
do while not rs.eof and rowcount>0
%>
<tr>
<td height="29">
<table width="100%" border="0">
<tr>
<SCRIPT language=JavaScript type=text/javascript>
function openMenu<%=rs("product_id")%>(){
if (document.getElementById){
document.getElementById("menu<%=rs("product_id")%>").style.visibility='visible';
}
}
function closeMenu<%=rs("product_id")%>(){
if (document.getElementById){
document.getElementById("menu<%=rs("product_id")%>").style.visibility='hidden';
}
}