asp内容分页代码

来源:百度知道 编辑:UC知道 时间:2024/09/25 18:50:25
我做个汇感之舟的网站,在内容显示页面,如果文章太大,那么就会拉的太长,所以请高手给我改些代码,能分页显示:代码如下:
<!--#include file="inc/fun.asp"-->
<!--#include file="inc/sys.asp"-->
<%
'====================================== 信息显示
infoid=request("keyid")
if infoid="" or IsNumeric(infoid)<>true then
response.write "<script>alert('错误,下面是产生错误的可能原因:\n\n·请输入正确的ID号!');history.go(-1);</Script>"
Response.End
end if
sql="select * from news where info_id="&infoid
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
infoshow=infoshow&"<br><div align=center>此内容不存在</div>"
else
newstitle=rs("info_title")
postime=rs("info_time")
classname=rs("info_clsname")
classid=rs("info_cls")
infojs=delhtml(left(replhtml(trim(rs(&qu

我是这样分页的,确定能用,给你看看,看能否帮上你的忙
<%
Dim currentpage,page_count,Pcount
dim totalrec,endpage
currentPage=request("page")
if currentpage="" then
currentpage=1
else
currentpage=clng(currentpage)
if err then
currentpage=1
err.clear
end if
end if
%>
一下是连接数据库
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from "你的表名"where "条件""
rs.open sql,conn,1,1
if not rs.eof then '1.判断是否有记录
rs.PageSize = 18 '每页18条记录
rs.AbsolutePage=currentpage
page_count=0
while (not rs.eof) and (not page_count =18)
for a=1 to rs.PageSize
page_count = page_count + 1
rs.movenext
if rs.eof then exit for
next
wend
Pcount=rs.PageCount
end if
%>
分页开始
<%
if currentpage > 4 then
response.write "<a href=""?page=1&