我根据http://www.5d.cn/bbs/newsdetail.asp?id=1109780&page=1&daysprune=&lp=1改了一个分页函数,出现了一个奇怪的现象,加入有5条记录,第一页显示全部5条记录,第二页显示3条记录,第三页显示1条记录,分页显示条正常,请问怎么回事
Function pagenum(rs)
rs.Pagesize=2
page=clng(request.querystring("page"
)
if page<1 or page=empty then page=1
if page>rs.pagecount then page=rs.pagecount
rs.Absolutepage=page
Dim query, a, x, temp
action = request.servervariables("path_info"
query = Split(Request.ServerVariables("QUERY_STRING"
, "&"
For Each x In query
a = Split(x, "="
If StrComp(a(0), "page", vbTextCompare) <> 0 Then
temp = temp & a(0) & "=" & a(1) & "&"
End If
Next
Response.Write ("<table width='80%' border='0' align='center' cellpadding='0' cellspacing='0' bgcolor='#e0e0e0'><tr>"
Response.Write ("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+this.page.value;return false;"">"
Response.Write ("<td>" )
If page<>1 then
Response.Write ("[<a href=" & action & "?" & temp & "Page=1>首页</a>] "
Response.Write ("[<a href=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</a>] "
end If
If page<>rs.pagecount then
Response.Write ("[<a href=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</a>] "
Response.Write ("[<a href=" & action & "?" & temp & "Page=" & rs.pagecount & ">尾页</a>]"
End If
Response.Write (" 输入页次:<input type=text name=page size=3 class='border' value="&page&"> 页次:"&page&"/"&rs.pagecount&" 共有记录"&rs.recordcount&"条 每页"&rs.Pagesize&"条</td>"
Response.Write ("</form></tr></table><br>"
End Function