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>
猜你喜欢
- 命名一直是个让我头痛的问题,特别是那些看上去差不多的模块,所以就得想办法啦,我总结了下面的方法,虽然还在试验中。希望对大家有帮助。欢迎大家提
- 09年的电影缓缓的落下帷幕,以及新年伊始,轰轰烈烈催人癫狂的《阿凡达》。整年里,最让人我记忆深刻的还是《飞屋历险记》。Carl与Ellie被
- 本文帮你六步改善SQL Server安全规划全攻略。一、什么是SQL注入式攻击所谓SQL注入式攻击,就是攻击者把SQL命令插入到Web表单的
- 用ASP实现搜索引擎的功能是一件很方便的事,可是,如何实现类似3721的智能搜索呢?比如,当在搜索条件框内输入“中国人民”时,自动从中提取“
- 互联网上不计其数的信息本质上都是一个一个的HTML文档组成的,通过链接将它们串联起整个互联网。这就犹如骨肉之于人体一样,只有通过经脉才能将它
- 这几个技术都不是很新了,现在还拿出来说也就是为了教教新手了呵呵,各位大虾多多指正.css之所以出现就是为了实现数据与数据的表现形式的分离,
- SQL Server管理,你做得好吗?下文这些可能会对你的工作有一些帮助,不妨耐心的看看吧。1. 数据库文件有.mdf .ndf .ldf三
- IE独有属性AlphaImageLoader用于修正7.0以下版本中显示PNG图片的半透明效果。这个滤镜的问题在于浏览器加载图片时它会终止内
- 方法一、尽量使用复杂的SQL来代替简单的一堆 SQL.同样的事务,一个复杂的SQL完成的效率高于一堆简单SQL完成的效率。有多个查询时,要善
- 下面是代码,如果看不懂,建议先把表格的一些<tr><td>的表格原理弄清楚了,就可以了代码如下:<table&
- SqlBulkCopy 来自数据源的 String 类型的给定值不能转换为指定目标列的类型 nvarchar。 在网上找了下,大都说是因为数
- 代码如下:<% '功能:取得文件扩展名 Function getFileExt(sFileNam
- 本文中,abigale代表查询字符串,ada代表数据表名,alice代表字段名。技巧一:问题类型:ACCESS数据库字段中含有日文片假名或其
- 用下列代码即可:<%On error resume nextSet session=Creat
- Dreamweaver快捷键大全,记住一些常用的快捷键会大大提高你的网页设计效率,如果你都使用快捷键,那么如果你去面试工作就容易被录取,呵呵
- 这段时间,关于asp的前途,关于asp的好坏的讨论贴,都有好些了。当然,大家的心都是好的,但是一些朋友说的话,真是让人郁闷。个人觉得,在现在
- 就在刚才,我给GMAIL安装了Twitter插件。安装完插件后,Gmail提示我要连接Twitter的账号才能使用:我顺着提示操作下去,就看
- 继续我们的 Javascript 优化计划,上期已经做到怎么尽可能的缩小 Javascript 脚本的文件体积便于传输。不过这样做仅仅是不够
- 同质化的网站越来越多,往往你还没发展起来,就已有许多站点抄袭走了你的成果,如何留下用户?——让用户有更好的使用体验。一些网页上的小技巧,可以
- 视觉设计是什么,人们怎么认为它的,自己又是怎么对待和理解它,它的核心价值是什么。视觉设计,冒似很艺术,跟艺术相关的职业,给大多数人的印象是做