当前位置:编程学习 > asp >>

asp中实用分页程序代码

page=request("page")
if page<>"" then
p_absolutepage=cint(page)
else
p_absolutepage=1
end if
sql="select * from [date]"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
p_pagesize=2
rs.pagesize=p_pagesize
rs.absolutepage=p_absolutepage
p_pagecount=rs.pagecount
if p_pagecount=0 then p_pagecount=1
p_recordcount=rs.recordcount

 

<div align="right">
<%if p_absolutepage<2 then%>
<span class="page" title="第一页">第一页</span>
<span class="page" title="上一页">上一页</span>
<%else%>
<a href="<%=filename%>?page=1"><span class="page" title="第一页">第一页</span></a>
<a href="<%=filename%>?page=<%=p_absolutepage-1%>"><span class="page" title="上一页">上一页</span></a>
<%end if%>
<%if p_pagecount-p_absolutepage<1 then%>
<span class="page" title="下一页">下一页</span> <span class="page" title="最后一页">最后一页</span>
<%else%>
<a href="<%=filename%>?page=<%=p_absolutepage+1%>">
<span class="page" title="下一页">下一页</span></a>
<a href="<%=filename%>?page=<%=p_pagecount%>">
<span class="page" title="最后一页">最后一页</span></a>
<%end if%>
页次:<%=p_absolutepage%>/<%=p_pagecount%>页][共<%=p_recordcount%>条][<%=p_pagesize%>条/页]
</div>

补充:asp教程,高级应用
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,