[页次:<font color=red><b><%=page%></b></font>/<%=rs.PageCount%>]
[共<%=rs.RecordCount%>篇 <font color=red><b><%=rs.PageSize%></b></font>篇/页]
转到<input name="page" size=5 value="<%=page%>">页
<input type="submit" value="Enter">
</form>
<%
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
%>
效果页面参看:
http://www.cnbruce.com/database/
长长的分页代码,搞懂是真不容易,平台引用起来还需要修改也是比较麻烦。最后能做成一个函数,下次调用起来就很方便了。
<% function pagination(pagecount,pagesize,page,resultcount) Dim query, a, x, temp action = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME") 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("<form method=get onsubmit=""document.location = '" & action & "?" & temp & "Page='+this.page.value;return false;"">") if page<=1 then Response.Write ("[首页] [上一页] ") else Response.Write("[<a href=" & action & "?" & temp & "Page=1>首页</a>] ") Response.Write("[<a href=" & action & "?" & temp & "Page=" & (Page-1) & ">上一页</a>] ") end if if page>=pagecount then Response.Write ("[下一页] [尾页]") else Response.Write("[<a href=" & action & "?" & temp & "Page=" & (Page+1) & ">下一页</a>] ") Response.Write("[<a href=" & action & "?" & temp & "Page=" & pagecount & ">尾页</a>]") end if Response.Write("[页次:<font color=red>" & page & "</font>/" & pageCount) Response.Write("] [共" & resultcount & "条 <font color=red>"& pagesize & "</font>条/页]") Response.Write(" 转到" & "<input name=page size=4 value=" & page & ">" & "页<input type=submit value=go>") End function %> 内容版权声明:除非注明,否则皆为本站原创文章。 |