为了账号安全,请及时绑定邮箱和手机立即绑定

您好,求助关于asp url重定向分页问题?这怎么写啊?

您好,求助关于asp url重定向分页问题?这怎么写啊?

守着一只汪 2021-11-02 21:07:17
<%set rs=server.createobject("adodb.recordset")rs.open "select * from sightn where 1=1 "&tj1&" "&tj2&" and 1=1 order by toporder,id",conn,1,1if rs.recordcount=0 then elsers.PageSize =24 '每页记录条数iCount=rs.RecordCount '记录总数iPageSize=rs.PageSizemaxpage=rs.PageCount page=request("page")if Not IsNumeric(page) or page="" thenpage=1elsepage=cint(page)end ifif page<1 thenpage=1elseif page>maxpage thenpage=maxpageend ifrs2news.AbsolutePage=Pageif page=maxpage thenx=iCount-(maxpage-1)*iPageSizeelsex=iPageSizeend ifFor i=1 To x<% call PageControl(iCount,maxpage,page,"border=0 align=right","")rs2news.closeset rs2news=nothingSub PageControl(iCount,pagecount,page,table_style,font_style)'生成上一页下一页链接Dim query, a, x, tempaction = "http://" & Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("SCRIPT_NAME")query = Split(Request.ServerVariables("QUERY_STRING"), "&")For Each x In querya = Split(x, "=")If StrComp(a(0), "page", vbTextCompare) <> 0 Thentemp = temp & a(0) & "=" & a(1) & "&"End IfNextif page<=1 then Response.Write "<li>|<上一页</li> " else Response.Write"<li><A HREF=" & action & "?" & temp & "Page=" & (Page-1) & ">|<上一页</A></li> " end iffor ii=1 to pageCountif page=ii thenResponse.Write"<li class='now'>"&ii&"</a></li>"elseResponse.Write"<li><A HREF=" & action & "?" & temp & "Page=" & (ii) & ">"&ii&"</a></li>"end ifnextif page>=pagecount thenResponse.Write "<li>下页>|</li> " elseResponse.Write "<li><A HREF=" & action & "?" & temp & "Page=" & (Page+1) & ">下页>|</A></li> " end if%></ul>共计<%=iCount%>条,共<%=pageCount%>页,每页<%=iPageSize%>
查看完整描述

1 回答

?
当年话下

TA贡献1890条经验 获得超9个赞

这个是最好的ASP ACCESS的分页。

set rs = conn.execute("select count(m_id) as HH_sum_vote_log from HH_say "&HS_haveid2&"")
HH_sum_vote_log = rs("HH_sum_vote_log")
rs.close
set rs = nothing
if HH_sum_vote_log>0 then
HH_sum_page_result=Round(HH_sum_vote_log/HH_pagesize,2)
HH_sum_page=cint(HH_sum_vote_log/HH_pagesize)
if HH_sum_page<HH_sum_page_result then
HH_sum_page=HH_sum_page+1
end if
else
HH_sum_page=1
end if
if isnumeric(HH_admpg) = false then
echo ("页码有误,将为您转向第一页!")
end if
if HH_admpg="" or HH_admpg<1 then
page = 1
else
page = cint(HH_admpg)
end if
if page < 1 or page > HH_sum_page then
echo ("页码有误,将为您转向第一页!")
end if
HH_sumpagemax="desc"
if page=HH_sum_page and page<>1 and HH_sum_page<>1 then
HH_pagesize_no=(HH_pagesize*HH_sum_page)-HH_sum_vote_log
if not HH_pagesize_no=0 then
HH_pagesize=HH_pagesize-HH_pagesize_no
HH_sumpagemax="asc"
end if
end if
set rs=server.createobject("adodb.recordset")
sql = "select * from (select top "&HH_pagesize&" * from (select top "&page*HH_pagesize&" * from HH_say "&HS_haveid&" order by Val([m_id]) "&HH_sumpagemax&") order by Val([m_id])) order by Val([m_id]) desc"
rs.open sql,conn,1,1
if rs.eof then
echo ("<script language='javascript'>alert('本项目没有访客留言,请返回!');window.history.go(-1);</script>")
rs.close
set rs=nothing
exit sub
end if
do while not rs.eof
rs.movenext
loop
<div id="H_page">第<%=page%>/<%=HH_sum_page%>页 共<%=HH_sum_vote_log%>条记录<%
if page=1 then%>
首页
<%else%>
<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=1" id="lianjie" class="zw">首页</a>
<%end if
if page<>1 then
%>
<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=page-1%>" id="lianjie" class="zw">上一页</a>..
<%else%>
上一页
<%end if
pg_px_top=page-5
pg_px_botton=page+5
for i=pg_px_top to pg_px_botton
if i<1 or i>HH_sum_page then
else
if i=page then
response.write i
else%>
<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=i%>"><%=i%></a>
<% end if
end if
next
if page<>HH_sum_page then
%>
..<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=page+1%>" id="lianjie" class="zw">下一页</a>
<%else%>
下一页
<%end if
if page<>HH_sum_page then%>
<a href="?class=<%=HH_admclass%><%=HH_idshow%>&pg=<%=HH_sum_page%>" id="lianjie" class="zw">尾页</a>
<%else%>
尾页
<%end if
echo ("</div>")
rs.close
set rs=nothing
%>

目前最好的ASP ACCESS分页法,无偿奉献



查看完整回答
反对 回复 2021-11-06
  • 1 回答
  • 0 关注
  • 263 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信