求“前十页”“后十页”这样的分页程序

ecobin 2004-01-01 02:10:04
就象动网论坛的“ 11 12 13 14 15 16 17 18 19 20 ”,可以翻到上10页和下10页的程序
期待。。谢谢csdn的朋友 ^_^
...全文
36 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
nomoodforjoking 2004-01-01
  • 打赏
  • 举报
回复
<%
function getPageCount( pageCount, RecordCount, rcPerPage)
pageCount=RecordCount/rcPerPage
pageCount=int(pageCount)
if (RecordCount mod rcPerPage)>0 then
PageCount=PageCount +1
end if
if pageCount<1 then
pageCount=1
end if
getPageCount=pageCount
end function

function getPage(page,pageCount)
if page="" or not isNumeric(page) then
page=1
else
page=int(page)
end if
if page>pageCount then
page=pageCount
end if
getPage=page
end function

%><%
function pageList()
dim p,i
if page<1 then
page=1
end if
if pagecount<1 then
pagecount=1
end if

'pagecount=2
p=int(page/pageLinkNum)
if page mod pageLinkNum>0 then
p=p+1
end if
p=(p-1)*pageLinkNum+1
'response.write p
'response.end
i=p+(pageLinkNum-1)
if i> pagecount then
i=pagecount
end if

if p>pageLinkNum then
pageList=pageList & "<a href='?page="&p-1&"'>[<<]</a>"
end if

do while p<=i
if p=page then
pageList=pageList & "["&p&"]"
else
pageList=pageList & "<a href='?page="&p&"'>["&p&"]</a>"
end if
p=p+1
loop

p=p-1
if p< pagecount then
pageList=pageList & "<a href='?page="&(p+1)&"'>[>>]</a>"
end if

end function
%>
这个应该能实现
从9seek留言簿里摘的一段,主要是利用一个求余的功能,以前写过一个,找不到了,过两天有空了,重新写一个给你,你去下载一个9seek留言簿吧
donworld 2004-01-01
  • 打赏
  • 举报
回复
<% RCOUNT = CInt(Request.Querystring("RCOUNT")) %>
<% If RCOUNT = "" Then %>
<% RCOUNT = "0" %>
<% End If %>
<%
Page = Request.QueryString("Page")
If IsEmpty(Request.QueryString("Page")) then Page = 1
%>
<%
sqlstmt = "SELECT * from book ORDER BY id DESC"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sqlstmt, conn, 3, 3
%>
<%

If rs.EOF then
‘没有留言,加入你的代码’
Else
TotalRecords = rs.recordcount
rs.Pagesize = 8
TotalPages = cInt(rs.pagecount)
rs.absolutepage=Page

%>
<%
rs.movenext
Next 'CountRecords
If Page > 1 Then
%>
<%
End If
If NOT rs.EOF then
%>
<center><td><a href="../Donnotebook/index.asp?Page=<%= Page + 1 %>">下一页 </a></td>
<td><a href="../Donnotebook/index.asp?Page=<%= TotalPages %>">最后一页</a> </td></center>
</tr>
</table>

是我在我的留言板里提出来的分页程序
希望对你有帮助
loveme2000ok 2004-01-01
  • 打赏
  • 举报
回复
关注!
xeimm 2004-01-01
  • 打赏
  • 举报
回复
楼上给你了,呵呵
kyn 2004-01-01
  • 打赏
  • 举报
回复
function page(Path,AllNum,MaxPage,Page,Show){
if (Page>MaxPage) Page=MaxPage+1
document.write(
'<center><table border=0 cellPadding=0 cellSpacing=0 width=95% style="table-layout:fixed;"><tbody>' +
' <tr><td width=30% nowrap>');
if (Show!=null) document.write('共有:<font color=red><b>' + AllNum + '</b></font>条记录 页数:<font color=red><b>' + Page + '</b></font>/' + MaxPage);
document.write(' </td><td align=right width=40% nowrap>');

if (MaxPage>10 && Show!=null) {
Min=parseInt(Page/10)*10
if (Min<1) Min=1
Max=parseInt(Page/10+1)*10
if (Max>MaxPage) Max=MaxPage
if (Max>100) Max=100

if (Min>1) document.write('<a href="' + Path + '?page=' + (Min-1) + '"><< </a> ');
for (i=Min;i<Max+1;i++) {
if (i<10) showpage=' ' + i; else showpage=i
if (i!=Page) document.write('<a href="' + Path + '?page=' + i + '">' + showpage + '</a> ');
else document.write('<b>' + showpage + '</b> ');
}
if (MaxPage>Max && Max<100) document.write('<a href="' + Path + '?page=' + (Max+1) + '"> >></a>');
}

document.write('</td><td align=right width=30% nowrap>');
document.write('<a href="' + Path + '?page=1"> 首页 </a> ');
if (Page>1) document.write('<a href="' + Path + '?page=' + (Page-1) + '">上一页</a> ');
if (MaxPage>Page) document.write('<a href="' + Path + '?page=' + (Page+1) + '">下一页</a> ');
document.write('<a href="' + Path + '?page=' + MaxPage + '"> 尾页 </a>');
document.write(
'</td></tr>' +
'</tbody></table>'
);
}
look4sword 2004-01-01
  • 打赏
  • 举报
回复
既然动网论坛有,那就下个动网来研究一下嘛.
我也不会,帮UP.
会织网的蚂蚁 2004-01-01
  • 打赏
  • 举报
回复
不会,我也来看看,回头再说。
qunluo 2004-01-01
  • 打赏
  • 举报
回复
gz
yjgx007 2004-01-01
  • 打赏
  • 举报
回复
困了,明天来看看
先帮你顶一下

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧