asp 分页 上一页 下一页代码

2015-08-12 16:02:31来源:作者:人点击

<%if request("typeid")=3 then
set rs=server.CreateObject("adodb.recordset")
  rs.open "select cdkey88_news.*,cdkey88_game.game_name from cdkey88_news,cdkey88_game where cdkey88_news.game_id=cdkey88_game.game_id and ( cdkey88_news.news_title like '%"&request("keywords")&"%' or cdkey88_news.news_content like '%"&request("keywords")&"%' or cdkey88_game.game_name like '%"&request("keywords")&"%') order by cdkey88_news.news_id desc",conn,1,1
%>
<table width="960" border="0" cellpadding="0" cellspacing="4" align="center" bgcolor="#FFFFFF">
  <!--DWLayoutTable-->
  <tr>
    <td width="700" height="206" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <%
   if rs.eof then
 response.write"<tr><td colspan=9 height=50 align=center><font color=#ff0000>对不起,没有找到相关记录!</font></td></tr>"
 end if
 if rs.recordcount<>0 then
 rs.pagesize=20
    if request("page")<>"" then
 currentpage=cint(request("page"))
 else
 currentpage=1
 end if
 if currentpage<=1 then
 currentpage=1
 end if
 if currentpage=>rs.pagecount then
 currentpage=rs.pagecount
 end if
 rs.AbsolutePage=currentpage
 end if
 do while not rs.eof
   %>
      <tr>
        <td width="700" height="131" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <!--DWLayoutTable-->
          <tr>
            <td width="700" height="30" valign="middle">&nbsp;<a href="news/show_news.asp?news_id=<%=rs("news_id")%>" target="_blank"><font color="#669933" style="font-size:14px"><b><%=rs("news_title")%></b></font></a></td>
            </tr>
          <tr>
            <td width="700" height="25" valign="middle">&nbsp;相关游戏:<a href="game/game_<%=rs("game_id")%>.html" target="_blank"><font color="#FF6600" style="font-size:12px"><b><%=rs("game_name")%></b></font></a></td>
            </tr>
          <tr>
            <td height="59" valign="top" style="line-height:20px; padding:5px"><font color="#878787"><%=left(RemoveHTML(rs("news_content")),180)%>.....</font></td>
              </tr>
          <tr>
            <td height="22" valign="middle">&nbsp;发布日期:<%=rs("date")%>&nbsp;&nbsp;查阅次数:<%=rs("click")%>次</td>
          </tr>
        </table></td>
        </tr>
  <tr><td colspan="4" background="images/bg5.gif"></td></tr>
  <tr><td colspan="4"  height="10"></td></tr>
   <%i1=i1+1
   if i1>=rs.pagesize then exit do
   rs.movenext
   loop
   %>
      <tr>
        <td height="75" align="center" valign="middle">第<font  color="#FF0000"><%=currentpage%></font>页/共<font  color="#FF0000"><%=rs.PageCount%></font>页&nbsp;&nbsp;共有<font  color="#FF0000"><%=rs.recordcount%></font>条记录&nbsp;&nbsp;&nbsp;
          <% 'if session("cur_page")>1 then %>
   <a href="?page=1&keywords=<%=request("keywords")%>&typeid=<%=request("typeid")%>">首页</a> 
   <a href="?page=<%=currentpage-1%>&keywords=<%=request("keywords")%>&typeid=<%=request("typeid")%>">上一页</a>
  <% 'end if%>
  <% 'if session("cur_page")<rs.PageCount  then %>
   <a href="?page=<%=currentpage+1%>&keywords=<%=request("keywords")%>&typeid=<%=request("typeid")%>">下一页</a> 
  <a href="?page=<%=rs.pagecount%>&keywords=<%=request("keywords")%>&typeid=<%=request("typeid")%>">末页</a>
 <% 'end if %></td>

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台