ASP图片分页代码 (通用)

时间:2009-06-22 12:57:00 

<table width="636" border="0" align="center" cellpadding="0" cellspacing="0">
<%
dim k,n   'k为显示的行数 n是一行显示的个数
set rs=server.createobject("adodb.recordset")
sql="select * from photo where hidden=true and c_id=92 order by id desc"
rs.open sql,conn,1,1
IF not rs.eof Then
proCount=rs.recordcount
rs.PageSize=8       '定义显示数目
n=4      '每行显示的数目
If rs.pagesize Mod n=0 Then
k=rs.pagesize/n
Else
k=rs.pagesize/n +1
End If
   if not IsEmpty(Request("ToPage")) then
        ToPage=CInt(Request("ToPage"))
     if ToPage>rs.PageCount then
      rs.AbsolutePage=rs.PageCount
      intCurPage=rs.PageCount
     elseif ToPage<=0 then
      rs.AbsolutePage=1
      intCurPage=1
     else
      rs.AbsolutePage=ToPage
      intCurPage=ToPage
     end if
    else
           rs.AbsolutePage=1
      intCurPage=1
    end if
intCurPage=CInt(intCurPage)

Dim ii, ij, im
ii=0
im=0
do while Not rs.eof And ii<k
%>
              <tr>
                <%
for ij=1 to n
%>
            <td><table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>
                        <table border="0" cellpadding="0" cellspacing="3">
                          <tr>
                            <td><table border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td><table width="120" height="150" border="0" cellpadding="1" cellspacing="1" bgcolor="#666600">
                                      <tr>
                                        <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                                            <tr>
                                              <td width="120" height="150" background="images/Wallpaper_5.jpg"><span class="unnamed2"><a href="photo_view.asp?id=<%=rs("id")%>" target=_blank><img src="upload/<%=rs("spic")%>" width="120" height="150" border="0" /></a></span></td>
                                            </tr>
                                        </table></td>
                                      </tr>
                                  </table></td>
                                  </tr>
                            </table></td>
                          </tr>
                          <tr>
                            <td>
                              <table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
                                <tr>
                                  <td><div align="center"><font color="#E23C08">
                                  <% if len(rs("name"))<=8 then
                                     Response.write rs("name")
                                     else
                                     response.write left(rs("name"),8)&"..."
                                     end if
                                     %>
                                     </font></div></td>
                                </tr>
                              </table></td>
                          </tr>
                        </table>
       </td>
                    </tr>
                </table>
              </td>
                <%
rs.movenext
if rs.eof then exit for
if rs.eof then exit do
Next
%>
              </tr>
              <%
ii=ii+1
im=im+1
If im>rs.pagesize Then Exit do
Loop
%>
          </table>
                    <table width="636" height="57" border="0" cellpadding="0" cellspacing="0" align=center>
                      <tr>
                        <td height="56">
                            <div align="right"><span style="font-size: 9pt;"> 总共:<font color="#ff0000"><%=rs.PageCount%></font>页, <font color="#ff0000"><%=proCount%></font>个产品, 当前页:<font color="#ff0000"> <%=intCurPage%> </font>
                                  <% if intCurPage<>1 then
    %>
                                  <a href="?ToPage=1">首页</a>ws<a href="?ToPage=<%=intCurPage-1%>">上一页</a>ws
                                  <% end if
if intCurPage<>rs.PageCount then %>
                                  <a href="?ToPage=<%=intCurPage+1%>">下一页</a>ws<a href="?ToPage=<%=rs.PageCount%>"> 最后一页</a>
                                  <% end if%>
                            </span></div>
                          </form>
                            <div align="right">
                              <%end if%>
                          </div></td>
                      </tr>
                  </table>

标签:分页,图片,asp
0
投稿

猜你喜欢

  • MySQL十条特殊技巧

    2007-09-17 12:33:00
  • asp里Sub与Function有什么区别

    2007-08-17 10:39:00
  • 如何增强网站数据库Access文件的安全性

    2008-11-13 16:58:00
  • JS+ASP实现无刷新新闻列表方法

    2007-08-22 12:44:00
  • 连续字符自动换行的解决方案

    2008-12-04 16:39:00
  • Javascript世界的最大整数值

    2008-06-23 13:23:00
  • 彻底弄懂CSS盒子模式之一(DIV布局快速入门)

    2007-05-11 17:03:00
  • 一些SQL查询语法参考

    2007-10-14 11:56:00
  • 仿QQ和MSN消息提示的效果代码

    2010-03-16 12:17:00
  • SQLServer中用T—SQL命令查询一个数据库中有哪些表的sql语句

    2012-07-11 15:28:50
  • W3C web标准概念入门

    2008-05-25 15:06:00
  • 用Dreamweaver MX实现网站批量更新

    2009-09-13 18:39:00
  • JScript RuntimeObject检测全局污染

    2010-09-13 12:26:00
  • MySQL Order By语法

    2011-01-04 19:58:00
  • CSS盒模型

    2009-06-09 14:23:00
  • SQL Server分析服务性能优化浅析

    2010-01-16 13:30:00
  • 准备SQL Server 2008透明数据加密

    2009-01-22 14:18:00
  • [译]“我心中的ebay”

    2008-06-04 12:09:00
  • 函数式编程让JS更优美

    2008-06-10 12:40:00
  • SQL SERVER EXPRESS 常见问题及解决办法

    2008-09-13 19:07:00
  • asp之家 网络编程 m.aspxhome.com