网站asp程序有分页的写法
当前位置:主页 > 北京网络建设 > 行业资讯 >


   <%
page=clng(request("page"))  
Set rs=Server.CreateObject("ADODB.RecordSet")

sql="select * from news where a='"&a&"'   order by pai desc"
rs.Open sql,conn,1,1


if rs.eof and rs.bof then
  response.Write("暂时没有记录")
else
%>


<%
rs.PageSize=24
if page=0 then page=1
pages=rs.pagecount
if page > pages then page=pages
rs.AbsolutePage=page 
for j=1 to rs.PageSize
%>

 

<%if rs("l3")<>"" then%>
<li><p><a href="<%=rs("l3")%>" target="_blank"><%=rs("title")%> </a></p><span><%=year(rs("Infotime"))%>.<%=month(rs("Infotime"))%>.<%=day(rs("Infotime"))%></span></li>
<%else%>
<li><p><a href="newsnw.asp?id=<%=rs("id")%>"><%=rs("title")%> </a></p><span><%=year(rs("Infotime"))%>.<%=month(rs("Infotime"))%>.<%=day(rs("Infotime"))%></span></li>
<%end if%>

<%
rs.movenext
if rs.eof then exit for
next
%>
</div>
<div class="fen"><form method=Post action="?a=<%=a%>&b=<%=b%>">
                          <%if Page<2 then     
    response.write "首页 上一页&nbsp;"
  else
    response.write "<a href=?a="&a&"&b="&b&"&page=1>首页</a>&nbsp;"
    response.write "<a href=?a="&a&"&b="&b&"&page=" & Page-1 & ">上一页</a>&nbsp;"
  end if
  if rs.pagecount-page<1 then
    response.write "下一页 尾页"
  else
    response.write "<a href=?a="&a&"&b="&b&"&page=" & (page+1) & ">"
    response.write "下一页</a> <a href=?a="&a&"&b="&b&"&page="&rs.pagecount&">尾页</a>"
  end if
   response.write "&nbsp;页次:<strong><font color=red>"&Page&"</font>/"&rs.pagecount&"</strong>页 "
    response.write "&nbsp;共<b><font color='#FF0000'>"&rs.recordcount&"</font></b>条记录 <b>"&rs.pagesize&"</b>条记录/页"
   response.write " 转到:<input type='text' name='page' size=4 maxlength=10 class=input value="&page&">"
   response.write " <input class=input type='submit'  value=' Goto '  name='cndok'></span></p>"    
%>
                        </form>
                  
</div>
 <%
end if
rs.close
set rs=nothing
%>

 

(发布时间:2012-11-17 22:55)


QQ在线咨询
点击这里给我发消息
点击这里给我发消息
24小时咨询热线
18801079534
客服咨询热线
010-86399882
  • 致电我们
  • 公司地址