熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp 分頁 上一頁 下一頁代碼

2013-11-13 10:38:04  來源: .NET編程 

  <%if request("typeid")= then
set rs=serverCreateObject("adodbrecordset")
  rsopen "select cdkey_news*cdkey_gamegame_name from cdkey_newscdkey_game where cdkey_newsgame_id=cdkey_gamegame_id and ( cdkey_newsnews_title like %"&request("keywords")&"% or cdkey_newsnews_content like %"&request("keywords")&"% or cdkey_gamegame_name like %"&request("keywords")&"%) order by cdkey_newsnews_id desc"conn
%>
<table width="" border="" cellpadding="" cellspacing="" align="center" bgcolor="#FFFFFF">
  <!DWLayoutTable>
  <tr>
    <td width="" height="" valign="top"><table width="%" border="" cellpadding="" cellspacing="">
      <%
   if rseof then
 responsewrite"<tr><td colspan= height= align=center><font color=#ff>對不起沒有找到相關記錄!</font></td></tr>"
 end if
 if rsrecordcount<> then
 rspagesize=
    if request("page")<>"" then
 currentpage=cint(request("page"))
 else
 currentpage=
 end if
 if currentpage<= then
 currentpage=
 end if
 if currentpage=>rspagecount then
 currentpage=rspagecount
 end if
 rsAbsolutePage=currentpage
 end if
 do while not rseof
   %>
      <tr>
        <td width="" height="" valign="top"><table width="%" border="" cellpadding="" cellspacing="">
          <!DWLayoutTable>
          <tr>
            <td width="" height="" valign="middle">&nbsp;<a href="news/show_newsasp?news_id=<%=rs("news_id")%>" target="_blank"><font color="#" style="fontsize:px"><b><%=rs("news_title")%></b></font></a></td>
            </tr>
          <tr>
            <td width="" height="" valign="middle">&nbsp;相關游戲<a href="game/game_<%=rs("game_id")%>html" target="_blank"><font color="#FF" style="fontsize:px"><b><%=rs("game_name")%></b></font></a></td>
            </tr>
          <tr>
            <td height="" valign="top" style="lineheight:px; padding:px"><font color="#"><%=left(RemoveHTML(rs("news_content")))%></font></td>
              </tr>
          <tr>
            <td height="" valign="middle">&nbsp;發布日期<%=rs("date")%>&nbsp;&nbsp;查閱次數<%=rs("click")%>次</td>
          </tr>
        </table></td>
        </tr>
  <tr><td colspan="" background="images/bggif"></td></tr>
  <tr><td colspan=""  height=""></td></tr>
   <%i=i+
   if i>=rspagesize then exit do
   rsmovenext
   loop
   %>
      <tr>
        <td height="" align="center" valign="middle">第<font  color="#FF"><%=currentpage%></font>頁/共<font  color="#FF"><%=rsPageCount%></font>頁&nbsp;&nbsp;共有<font  color="#FF"><%=rsrecordcount%></font>條記錄&nbsp;&nbsp;&nbsp;
          <% if session("cur_page")> then %>
   <a href="?page=&keywords=<%=request("keywords")%>&typeid=<%=request("typeid")%>">首頁</a> 
   <a href="?page=<%=currentpage%>&keywords=<%=request("keywords")%>&typeid=<%=request("typeid")%>">上一頁</a>
  <% end if%>
  <% if session("cur_page")<rsPageCount  then %>
   <a href="?page=<%=currentpage+%>&keywords=<%=request("keywords")%>&typeid=<%=request("typeid")%>">下一頁</a> 
  <a href="?page=<%=rspagecount%>&keywords=<%=request("keywords")%>&typeid=<%=request("typeid")%>">末頁</a>
 <% end if %></td>


From:http://tw.wingwit.com/Article/program/net/201311/14175.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.