程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> ASP編程 >> 關於ASP編程 >> asp 分頁 上一頁 下一頁代碼

asp 分頁 上一頁 下一頁代碼

編輯:關於ASP編程

    <%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>

    1. 上一頁:
    2. 下一頁:
    Copyright © 程式師世界 All Rights Reserved