[求助] 我问了十多个高手也没有解决的问题,关于分页技术的,不会报错的,拿出来大家看看,请大家指教啊。
就是我有一行怎么也看不懂啊。第12行 if (0==Request("page").count) {Page=1;} 其中的Request("page").count)是什么意思啊?
7-7.asp
<%@ language="javascript" %>
<!--#include file="OnePage.asp"-->
<html><head><title>新功能分页显示</title></head>
<body bgcolor="#66ccff">
<h2 align="center">该程序具有前进和后退功能</h2><hr>
<% conn=Server.CreateObject("ADODB.Connection");
conn.open("DSN=myAccessDSN","Database=db1");
rs=Server.CreateObject("ADODB.Recordset");
sql="score";
rs.Open (sql,conn,3);
rs.pagesize=3;
if (0==Request("page").count) {Page=1;}
else {Page=parseInt(Request("Page"))}
if (Page<1) {Page=1;}
if (Page>rs.PageCount) {Page=rs.PageCount;}
ShowOnePage(rs,Page);
Response.Write("<div align=right>");
Response.Write("<hr>");
if (!(1==Page))
{
Response.Write("<A HREF=7-7.asp?Page=1>第一页</A>");
Response.Write("<A HREF=7-7.asp?Page="+(Page-1)+">上一页</A>");
}
if (!(rs.PageCount==Page))
{Response.Write("<A HREF=7-7.asp?Page="+(Page+1)+">下一页</A>");
Response.Write("<A HREF=7-7.asp?Page="+rs.PageCount+">最后一页</A>");}%>
<p>页数:<font COLOR="Red"><%=Page%>/<%=rs.PageCount%></font></p>
</div></body></html>
对了,还有OnePage.asp的内容如下:
<%
function ShowOnePage( rs, Page )
{
Response.Write("<CENTER><table border=4 bordercolor=orange>");
Response.Write("<TR bgcolor=orange>");
Response.Write("<TD><font color=white><b>编号</b></font></TD>");
var i;
for (i=0; i<rs.Fields.Count; i++)
{
Response.Write("<TD><font color=white><b>" + rs.Fields(i).Name + "</b></font></TD>");
}
Response.Write("</TR>");
rs.AbsolutePage = Page;
var iPage;
for (iPage=1; iPage<=rs.PageSize; iPage++)
{
if (!rs.EOF)
{
Response.Write("<TR align=middle>");
RecNo = (Page - 1) * rs.PageSize + iPage;
Response.Write("<TD>" + RecNo + "</TD>");
for(i=0; i<rs.Fields.Count; i++)
{
Response.Write("<TD>" + rs.Fields(i).Value + "</TD>");
}
Response.Write("</TR>");
rs.MoveNext();
}
}
Response.Write("</TABLE></CENTER>");
}
%>