请教高手,asp长文章分页显示

来源:百度知道 编辑:UC知道 时间:2024/09/28 07:56:49
由于刚学ASP网页制作,在网上下了一个“D.S HOME 个人文章发布系统”,用那个系统发表了些文章,才发现文章长的话显示使页面一点都不美观,修改了很多次里面的“list.asp",在网上也找了很多分页代码都未能成功分页。
请教各位ASP高手,帮忙修改一下"list.asp"的代码,使“数据库”里面的“内容”成功显示在“list.asp”页面,并且“分页”显示!
看了一下下面的答案,我是希望把数据库里面的“Content”的内容通过 “ list.asp"前台显示啊!
list.asp的源代码是:
<!--#include file="conn.asp"-->
<%
dim sql
dim rs
dim title
set rs=server.createobject("adodb.recordset")
sql="update article set hits=hits+1 where articleID="&request("id")
rs.open sql,conn,1,3
sql="select article.title from article where article.articleID="&request("id")
rs.open sql,conn,1,1
if not rs.eof then
title=rs("title")
end if
rs.close
%>

<html>
<head>
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<LINK href="style.css&

'读取数据库
content=rs("content")

page=request("page")
PageLength=2000
if not isempty(page)then
page=cint(page)
else
page=1
end if
if page<1 then
page=1
end if
Length = Len(content)
PageCount = CInt(length/PageLength)
if page=1 then
wen= mid(content,1,1500)
response.write(wen)
else
wen= mid(content,(page-1)*pagelength,1500)
response.write(wen)
end if
%>
<%if PageCount>1 then%>
<div align=left>
本章共有<%=length%>字
<%
Response.write ( ("本节共")) & PageCount & ("页")&" "&("当前为"&page&"页")

if page<2 then
%>
首页 上一页
<%else%>
<a href=?ps_id=<%=id%>&Page=1>首页
</a>
<a href=?ps_id=<%=id%>&Page=<%= page-1%>>上一页 </a>
<%
end if
if pagecount-page<1 then <