asp分页代码

<%
title="产品展示"
seat="<a href='sc_index.html'>首页</a> > "&"产品展示"
%>
<!--#include file="include/conn.asp"-->
<!--#include file="include/head.asp"-->
<%
'默认
sql="select * from prodinfo order by id desc"
'按所选类型
if request.QueryString("p1")<>"" then
   classid=trim(request.QueryString("p1"))
   set rs0=conn.execute("select classname from bigclass where id="&trim(classid))
   if not rs0.eof then
      seat="<a href='sc_index.html'>首页</a> > "&"<a href='sc_product.html'>产品展示</a> > "&rs0(0)
   end if
   sql="select * from prodinfo where bigclass="&trim(classid)&" order by id desc"
end if

set rs1=server.CreateObject("adodb.recordset")
rs1.open sql,conn,1,1

rs1.pagesize=9
p = trim(Request.QueryString("p2"))

if len(p) = 0 then
     p = 1
else
   if cint(p) =< 1 then
     p = 1
   else
    if cint(p) >= rs1.PageCount then
     p = rs1.PageCount
    else
      p = cint(p)
   end if
end if
end if

if not rs1.eof then
rs1.AbsolutePage = p
end if
%>
<table width="930" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
    <td width="190" height="300" valign="top">
<!--#include file="include/left.asp"-->
</td>
    <td width="15" style="border-left:1px #CCCCCC solid">&nbsp;</td>
    <td width="715" valign="top">
   <table width="100%" border="0" cellpadding="0" cellspacing="0" id="1">
        <tr>
          <td align="left" valign="top" height="158">
    <%set rs0=conn.execute("select img from banner where id=2")
    if not rs0.eof then
    %>   
    <img src="<%=rs0(0)%>" width="710" height="150" />
    <%end if%>
    </td>
          </tr>
      </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="2%" height="30" align="left"><img src="images/dot_2.jpg" width="5" height="18" /></td>
        <td width="98%" align="left" style="color:#2B4B73; font-size:13px; font-weight:bold"><%=seat%></td>
      </tr>
      <tr>
        <td height="100" colspan="2" valign="top">
   <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <%
    lie=3
    row=int(-1*rs1.recordcount/lie)*(-1) '行数分
    num=0
    %>   
    <%for j=1 to row%>
    <tr>
    <%for i=1 to lie%>
    <td width="236" height="220" align="center">
     <a href="sc_showprod-<%=rs1("id")%>.html">
     <img src="<%=rs1("img")%>" border="0" /></a><br />
     <a href="sc_showprod-<%=rs1("id")%>.html">
        <%=rs1("prodname")%></a><br />    
    </td>
             <%num=num+1
      if num=rs1.pagesize then exit for
      rs1.moveNext
      if(i=lie or rs1.eof) then exit for
      next     
        if i<lie then
       for k=i+1 to lie
        response.Write("<td width='236' height='220' align='center'>&nbsp;</td>")
       next
        end if
     
        response.Write("</tr>")
     if num=rs1.pagesize then exit for
        if rs1.eof then exit for
    next
    %>   
        </table></td>
      </tr>
    </table>
<br/><span class="ah">
   共个<%=rs1.recordcount%>条记录&nbsp; 当前页:<%=p%>/<%=rs1.pagecount%> &nbsp;页大小:<%=rs1.pagesize%>&nbsp;
   <%if rs1.pagecount>1 then%>
   <a href="sc_product-<%=classid%>-1.html">首页</a>
   <a href="sc_product-<%=classid%>-<%=p-1%>.html">上一页</a>
   <a href="sc_product-<%=classid%>-<%=p+1%>.html">下一页</a>
   <a href="?sc_product-<%=classid%>-<%=rs1.pagecount%>.html">末页</a>
   <%end if
      rs1.close%></span>
    <br/>
</td>
    <td width="10">&nbsp;</td>
</tr>
</table>
<!--#include file="include/foot.asp"-->
<%
conn.close
set conn=nothing
%>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值