| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 475 人关注过本帖
标题:翻页?
只看楼主 加入收藏
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
收藏
 问题点数:0 回复次数:4 
翻页?

这是一个带列表的翻页程序:
<!--#include file="conn.inc"-->
<link href="../text.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #C4ECFF;
}
.style1 {font-size: 12px}
-->
</style><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<p>&nbsp;</p>
<p align="center"><strong>图片管理</strong></p>
<table width="599" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#C4ECFF">
<%
set rs=server.createobject("adodb.recordset")
sql= "SELECT * FROM img order by id Desc "
rs.open sql,conn,1,1
if rs.eof and rs.bof then %>
<p align="center">&nbsp;</p>
<p align="center"><span class="style1">还没有图片!</span><br>
</p>

<%
else
dim MaxPerPage
dim sql
dim rs
dim gstBookID
dim totalPut
dim CurrentPage
dim TotalPages
filename="Manage_Img.asp"
if not isempty(request("page")) then
currentPage=request("page")
else
currentPage=1
end if
rs.pagesize=10
totalPut=rs.recordcount '记录总数
totalPage=rs.pagecount
MaxPerPage=rs.pagesize
if currentpage<1 then
currentpage=1
end if
if currentpage>totalPage then
currentpage=totalPage
end if
if currentPage=1 then
showContent
showpages1
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark '移动到开始显示的记录位置
showContent
showpages1
end if
end if
rs.close
end if
set rs=nothing

set conn=nothing
sub showContent
dim i,j
%>

<table width="115" height="26" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td><table width="570" border="0" align="center" cellpadding="0" cellspacing="0" class="default">
<tr align="center" onmouseover="javascript:this.bgColor='#F7F7F7';" onmouseout="javascript:this.bgColor='#C4ECFF';"">
<td width="58" height="28" class="style1">序号</td>
<td width="98" class="style1">图片名称</td>
<td width="93" class="style1">图片</td>
<td width="125" align="right"><div align="center" class="style1">添加日期</div></td>
<td width="147" class="style1">操作</td>
<td width="49" class="style1">操作</td>
</tr>
<%
i=1
do while not (rs.eof or err)%>
<tr onmouseover="javascript:this.bgColor='#F7F7F7';" onmouseout="javascript:this.bgColor='#C4ECFF';"">
<td height="25" align="center" class="style1"><%=rs("id")%></td>
<td style="padding-left:10px"><div align="center"><a href="imagesnew.asp?id=<%=rs("id")%>" target="_blank" class="style1"><%=rs("title")%></a></div></td>
<td align="center"><img name="" src="http://www.qyph.com.cn/<%=rs("img")%>" width="90" height="60" alt=""></td>
<td align="center" class="style1"><%=rs("time")%></td>
<td align="center"><a href="Manage_editImg.asp?id=<%=rs("id")%>" class="style1">修改</a></td>
<td align="center"><a href="del_Img.asp?id=<%=rs("id")%>" class="style1">删除</a></td>
</tr>
<%
if i>=MaxPerPage then exit do
i=i+1
rs.movenext
loop
%>
<tr>
<td height="30" colspan="7" align="center">
<%
end sub
%>
<%
sub showpages1()
dim n
n=totalPage
%>
<form action="<%=filename%>" method="post" align="right">
<table width="100%" height="30" border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111">
<tr>
<td height="30">
<div align="right"> <span style="font-size:9pt"> <span class="style1">共<font color="#FF0000"><%=totalPage%></font>页/<font color="red"><%=totalPut%></font>条信息 </span></span>
<span class="style1">
<% If currentPage <> 1 Then %>
<a href=<%=filename%>><font color="#FF6600"><span style="font-size:9pt">[首页]</span></font></a> <a href=<%=filename%>?Page=<%=(currentPage-1)%>><font color="#FF6600"><span style="font-size:9pt">[上一页]</span></font></a>
<% End If %>
<% If currentPage <> rs.PageCount Then %>
<a href=<%=filename%>?Page=<%=(currentPage+1)%>><font color="#FF6600"><span style="font-size:9pt">[下一页]</span></font></a> <a href=<%=filename%>?Page=<%=totalPage%>><font color="#FF6600"><span style="font-size:9pt">[尾页]</span></font></a>
<% End If %>
<span style="font-size:9pt"> 第<font color="#FF0000"><%=currentPage%></font>页/共<font color="#FF0000"><%=totalPage%></font>页
<%
response.write " 转到:<select name='page' size=1 class=smallselsect style='font-family: 宋体; font-size: 9pt;'>"
for i=1 to n
response.write "<option value="& i
if currentpage=i then
response.write " selected"
end if
response.write ">"& i &"</option>"
next
response.write "</select>"
response.write"<input name='types' type='hidden' value='"&request("types")&"'>"
response.write "&nbsp;<input class=buttonface type='submit' value='go' style='font-family: 宋体; font-size: 9pt;'>"
%>
</span></span> </div></td>
</tr>
</table>
</form></td>
</tr>
</table></td>
</tr>
</table>
<%end sub%>
</p></td>
</tr>
</table>
</td>
</tr>
</table>

没有提示错误,但是一点“下一页”就直接蹦到“尾页”,中间的几页出不来,为什么?

搜索更多相关主题的帖子: css html content include center 
2006-01-05 09:25
suyongtao
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:33
帖 子:8674
专家分:127
注 册:2004-11-6
收藏
得分:0 
代码没错..汗..你看看是不是你的数据有问题因为我用的就是这个分页.

面朝大海,春暖花开!
2006-01-05 10:55
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
收藏
得分:0 
数据库会有什么问题

2006-01-05 13:07
酷酷的鱼
Rank: 1
等 级:新手上路
威 望:1
帖 子:472
专家分:0
注 册:2005-8-9
收藏
得分:0 

没有人知道嘛


2006-01-06 13:13
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
怎么给你测试 要不你把能运行的包括数据库的一套程序发上来
2006-01-06 13:15
快速回复:翻页?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017476 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved