ps:这个是分页news_more的代码,我把原来做的一个网站的分页代码(可用)拿来复制到新的网页上,再做一些修改
/xiaoxippzyh/work/news_more.asp, 第 40 行
第 40 行是rs.absolutepage=pageNo
发现调用不了数据,数据显示不出来,
(我只贴了一部分代码)
<!--#include file="system/include/config.asp"-->
<!--#include file="system/include/conn.asp"-->
<%
dim strSql,rs,pageNo,PageType,PageTitle
if not isnumeric(request("type")) then
PageType=1
else
PageType=cint(request("type"))
end if
select case PageType
case 1
PageTitle="站内公告"
case 2
PageTitle="个人新闻"
case 3
PageTitle="游戏新闻"
case 4
PageTitle="业内新闻"
case 5
PageTitle="技术精粹"
case 6
PageTitle="留言板"
end select
'翻页=======================
if not isnumeric(request("page")) then
pageNo=1
else
pageNo=cint(request("page"))
end if
if pageNo=0 then
pageNo=1
end if
strSql="select * from [news] where a_type=" & PageType & " order by a_id desc"
set rs=Server.CreateObject("ADODB.RecordSet")
rs.open strSql,conn,3,3
rs.pagesize=20 '每页显示20条记录
if pageNo>=rs.pagecount then
pageNo=rs.pagecount
end if
rs.absolutepage=pageNo '当前页
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
dim i
for i=1 to rs.pagesize
if rs.eof then
exit for
end if%>
<tr>
<td height="14" align="left" valign="top"><font color="#FF6600" >·</font><a href="news_sub.asp?id=<%=rs("a_id")%>" target="_blank" ><%=rs("a_title")%></a> <font color="#999999" >[<%=rs("a_date")%>]</font> </td>
</tr>
<%
rs.movenext '指针下移语句
next
%>
</table>
<table width="586" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="303">共<font color=red><%=rs.recordcount%></font>条 每页显示<font color=red><%=rs.pagesize%></font>条
当前页:<font color=red><%=pageNo%></font>/<font color=red><%=rs.pagecount%></font></td>
<td width="283" align="right" valign="middle">[<a href="news_more.asp?page=1&type=<%Response.write PageType%>" >首页</a>]
[<a href="news_more.asp?page=<%response.write pageNo-1%>&type=<%Response.write PageType%>" >上一页</a>]
[<a href="news_more.asp?page=<%response.write pageNo+1%>&type=<%Response.write PageType%>" >下一页</a>]
[<a href="news_more.asp?page=<%response.write rs.pagecount%>&type=<%Response.write PageType%>" >尾页</a>]</td>
</tr>
</table>
<br>
<p> </p>
</td>