用asp写一个分页函数,每页显示10条记录,具有首页,上一页,下一页,尾页,当前页/总页数等功能,谢谢了
来源:百度知道 编辑:UC知道 时间:2024/04/27 22:11:13
请各位高手帮忙写一个,急!急!急!谢谢!
%
const MaxPerPage=10
'分页显示新闻个数
dim totalput,currentPage,TotalPages,typ,sql
typ=request.QueryString("type")
if typ<>"" then
if not isempty(request.querystring("num")) then
currentPage=cint(request.querystring("num"))
else
currentPage=1
end if
%>
<%
sql="select * from news where news_type="&typ&" order by news_time desc"
rs.open sql,conn,1,1
totalPut=rs.recordcount
if rs.eof then
response.write "<p align='center'> 没有相关新闻</p>"
else
if currentpage<1 then
currentpage=1
end if
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
showContent
showpages
end if
end if
if (currentPage-1)*MaxPerPage=totalPut then
rs.move (currentPage-1)*MaxPerPage<