<%
cateid=request("cateid")
subcateid=request("subcateid")
sql="select * from products,cate,subcate where cate.cateid=subcate.cateid and cate.cateid=products.cateid and products.subcateid=subcate.subcateid  "
if cateid<>"" then
  sql=sql&" and cate.cateid="&cateid
end if
if subcateid<>"" then
  sql=sql&" and subcate.subcateid="&subcateid
end if
sql=sql&" order by addtime desc"
rs.pagesize=12
rs.open sql,conn,1,1
if not(rs.bof or rs.eof) then
page=cint(request.Form("page"))
if page=0 or page>rs.pagecount then
   page=1
end if
rs.absolutepage=page
response.Write("<table width='98%' border='0' cellspacing='0' cellpadding='0' align='center'><tr>")
for i=1 to rs.pagesize
  response.Write("<td width='25%'><table width='100%' border='0' align='center'><tr>")
  response.Write("<td width='100%' align='center'><a href='products_show.asp?id="&rs("id")&"' target='_blank'><img src='products/"&rs("pics")&"' border='0' width='125' height='141' alt='<产品名称："&rs("p_name")&"><br><点击次数："&rs("Click")&"'>></a></td></tr>")
  response.Write("<tr><td align='center' >产品名称："&rs("p_name")&"</td></tr>")
  response.Write("<tr><td align='center' >产品型号："&rs("p_no")&"</td></tr>")
  response.Write("</td></tr></table></td>")
  rs.movenext
  if rs.eof then exit for
  if i mod 4=0 then response.write("</tr><tr>")
next
response.Write("</tr></table>")
response.Write("<form action='new.asp' method='post' name='form1'>")
response.Write("<input name='keys' type='hidden' value='"&keys&"'><input name='cateid' type='hidden' value='"&cateid&"'>")
response.Write("<input name='subcateid' type='hidden' value='"&subcateid&"'><input name='page' type='hidden' value='"&page&"'>")
response.Write("<table widht='90%' align='center'><tr><td>本类共有 "&rs.recordcount&" 个商品&nbsp;&nbsp;第"&page&"页（共"&rs.pagecount&"页）</td><td>")
response.Write("第一页< style='cursor:hand;' onclick='document.form1.page.value=1;submit();'>")
response.Write("第一页< style='cursor:hand;' onclick='document.form1.page.value-=1;submit();'>")
response.Write("第一页<img src='images/comm/next.gif' style='cursor:hand;' onclick='document.form1.page.value=parseInt(document.form1.page.value)+1;submit();'>")
response.Write("<img src='images/comm/end.gif' style='cursor:hand;' onclick='document.form1.page.value="&rs.pagecount&";submit();'></td></tr></table>")
response.Write("</form>")
end if
rs.close
%>