分页代码

 

<!--#include file="conn.asp"-->
<%
N_type
=request("N_type")


set rs = server.createobject("adodb.recordset")

sql 
= "select * from news"
if N_type<>"" then sql=sql&" where N_type='"&N_type&"'"
sql=sql&" order by N_id desc"
rs.Open SQL, Conn, 11
rs.pagesize=20
PageNo=request("PageNo")

if request("PageNo")="" then PageNo=1
totalpages=rs.pagecount
if request.servervariables("content_length"> 0 then
    currentpage=1
else
    currentpage=clng(PageNo)
end if
if currentpage>totalpages then currentpage=totalpages 
if not(rs.eof) then rs.absolutepage = currentpage
%
>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻列表</title>
<LINK href="rsc.css" type=text/css rel=stylesheet>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#999999">
        <tr bgcolor="#E3E8F9"> 
          
<td height="15" bgcolor="#E3E8F9"> 
            
<div align="center"><font size="2"><strong>项 目 标 题</strong></font></div></td>
          <td width="80" height="18"> 
            
<div align="center"><font size="2"><strong>项目类型</strong></font></div></td>
          <td width="120" height="18"> 
            
<div align="center"><font size="2"><strong>管理</strong></font></div></td>
        </tr>
        <%
rowcount
=(currentpage - 1)*rs.pagesize
for i=1 to rs.pagesize
    
if rs.eof then exit for
        %>
        <tr bgcolor="#F4F8FF"> 
          
<td height="20" title="<%=rs("N_time")%>"><a href="shownews.asp?N_id=<%=rs("N_id")%>" target=_blank><%if rs("N_hot")=true then response.write "<font color=red>"%><%=left(rs("N_title"),22)%> 
            
<%if len(rs("N_title"))>22 then response.write "……"%><%if rs("N_pic")<>"" then%>[图]<%end if%>
            </a></td>
          <td> <div align="center"><a href="?N_type=<%=rs("n_type")%>"><%=rs("n_type")%></a></div></td>
          <td> 
            
<div align="center"> 
<%if session("userlimit")>0 then%>
              <%if rs("N_enabled")=false then%>
              <a href="enablednews.asp?N_id=<%=rs("N_id")%>&pageno=<%=PageNo%>"><font color=green>通过</font></a> 
              
<%else%>
              <a href="enablednews.asp?N_id=<%=rs("N_id")%>&pageno=<%=PageNo%>"><font color=red>取消</font></a> 
              
<%end if%>
<%end if%>
<%if session("userlimit")>0 or (session("userlimit")<1 and rs("N_enabled")=false)then%>&nbsp;&nbsp;<a href="editnews.asp?N_id=<%=rs("N_id")%>&pageno=<%=PageNo%>">修改</a><%end if%>
<%if session("userlimit")>0 then%>&nbsp;&nbsp;<a href="javascript:if(confirm('您确定要删除此条信息?')) window.location.href='delnews.asp?N_id=<%=rs("N_id")%>&pageno=<%=PageNo%>'">删除</a><%end if%>
        </div>
        </td>        
        
</tr>
        <%
    rs.movenext
next                 
%
>
      </table>
      
    
</td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="20" bgcolor="#E3E8F9"> 
      
<div align="center"> 
        
<%if currentpage>1 then%>
        <a href="?N_type=<%=N_type%>&pageno=1"> 〖首页〗</a>&nbsp;&nbsp;<a href="?N_type=<%=N_type%>&pageno=<%=currentpage-1%>">〖上一页〗</a>&nbsp;&nbsp; 
        
<%end if                       
                
if currentpage < totalpages then%>
        <a href="?N_type=<%=N_type%>&pageno=<%=currentpage+1%>">〖下一页〗</a>&nbsp;&nbsp;<a href="?N_type=<%=N_type%>&pageno=<%=totalpages%>">〖尾页〗</a> 
        
<%end if%>
        &nbsp; 本页是第 <%=currentpage%>/<%=totalpages%> 页 共&nbsp;<%=rs.recordcount%>&nbsp;条 
        转到第
      
<select name="sel_page" onChange="javascript:location=this.options[this.selectedIndex].value;">
      <%
       
for i = 1 to rs.PageCount
       
if i = currentpage then%>
       <option value="?N_type=<%=N_type%>&pageno=<%=i%>" selected><%=i%></option>
      <%else%>
       <option value="?N_type=<%=N_type%>&pageno=<%=i%>"><%=i%></option>
      <%
      
end if
      next
      %>
     </select>
      
</div>    
    
</td>
  </tr>
</table>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值