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
投稿

猜你喜欢

  • Linux下编译安装Mysql 5.5的简单步骤

    2024-01-27 13:33:03
  • Mysql中的排序规则utf8_unicode_ci、utf8_general_ci的区别总结

    2024-01-13 14:39:02
  • Python新版极验验证码识别验证码教程详解

    2022-03-07 01:02:55
  • 禁止背景图在网页中平铺

    2011-04-29 14:10:00
  • OpenCV黑帽运算(BLACKHAT)的使用

    2022-11-11 22:32:00
  • Go语言中的流程控制结构和函数详解

    2024-02-14 10:27:24
  • python解决12306登录验证码的实现

    2023-05-29 10:28:35
  • MySQL 修改密码实例详解

    2024-01-27 05:36:28
  • python 解决flask 图片在线浏览或者直接下载的问题

    2022-05-15 06:24:57
  • python中__init__()方法详情

    2023-06-05 21:22:46
  • IIRF(Ionic's Isapi Rewrite Filt er)入门,在IIS上重写Url

    2007-09-23 12:16:00
  • JS数组Array常用方法汇总+实例

    2024-04-30 10:42:02
  • SQL Server 2000/2005/2008删除或压缩数据库日志的方法

    2024-01-20 15:56:15
  • Django中ORM找出内容不为空的数据实例

    2022-03-24 04:47:56
  • Python数据可视化教程之Matplotlib实现各种图表实例

    2021-08-19 01:18:10
  • 一小时学会TensorFlow2之Fashion Mnist

    2023-01-27 12:08:16
  • div水平垂直居中方法(淘宝招聘css题目)

    2007-10-25 12:48:00
  • python实现TCP文件接收发送

    2021-08-25 00:56:46
  • 微信小程序如何实现radio单选框单击打勾和取消

    2024-06-17 20:41:19
  • Python模块学习 filecmp 文件比较

    2023-07-09 18:30:44
  • asp之家 网络编程 m.aspxhome.com