每一种美,都会有一双眼睛能看到;每一份爱,总会有一颗心会感受到。

分页

AbsolutePage--指示当前记录所在的页。

设置和返回值:
设置或返回从 1 到 rs 对象所含页数 (PageCount) 的 Long 值,或者返回一个 PositionEnum 值。

说明:
用 AbsolutePage 属性标识当前记录所在的页码。用 PageSize 属性将 rs 对象逻辑划分为一系列的页,每一页的记录数都等于 PageSize(最后一页除外,因为它的记录数可能较少)。提供者必须支持相应的功能才能使用此属性。

与 AbsolutePosition 属性一样,AbsolutePage 也是从 1 开始,并且当前记录是 rs 的第一个记录时等于 1。设置此属性以移动到某一页的第一个记录。通过 PageCount 属性获得总页数。

<tr>
                <td><br>
                  <%
 set rs = server.createobject("adodb.recordset")
 tea_arttype=request("tea_arttype")
 if tea_arttype="" then
  sql="select * from tea_data order by id desc"
 else
     sql="select * from tea_data where tea_arttype = '" &tea_arttype & "' order by id desc"
 end if
 rs.open sql,conn,1,1
 
 if rs.bof and rs.eof then
  response.write "暂无新闻"
 else
%>
                  <br />
                  <table width="91%" height="20" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                      <td width="680" height="20"><table width="100%" height="27" border="0" align="center" cellpadding="0" cellspacing="0">
                          <tr align="center">
                            <%
 dim curpage,j            
 if request("page")="" then            
  curpage = 1            
 else            
  curpage = cint(request("page"))            
 end if            

 rs.pagesize = 17
 rs.absolutepage = curpage 

 for j = 1 to rs.pagesize
%>
                            <td width="680" height="27" valign="middle"><table width="100%" height="24" border="0"  cellpadding="0" cellspacing="0" background="images/xuxian.gif">
                                <tr>
                                  <td width="82%" height="24" class="tdline">&nbsp;<img src="images/bot.jpg" width="9" height="9" />&nbsp;&nbsp;<a href="show.asp?id=<%=rs("id")%>" target="_blank"><%=rs("tea_topic")%></a></td>
                                  <td width="18%" align="center" class="tdline"><font color="#5D5C5C">(<%=rs("tea_time")%>)</font></td>
                                </tr>
                            </table></td>
                            <%
if (j mod 1)=0 then response.write "</tr><tr><td></td></tr><tr align='center' background='images/probg.jpg'>"
rs.movenext        
 if rs.eof then            
  j = j + 1            
  exit for
  end if        
next
%>
                          </tr>
                      </table></td>
                    </tr>
                  </table>
                  <br />
                  <div align="left"  class="12font">
                    <form action="" method="post">
                      <%
response.write "<center>"            
response.write "第<font color=red>" + cstr(curpage) + "</font>页/总" + cstr(rs.pagecount) + "页 "            
response.write "每页显示"&rs.pagesize&"个,总共有" + cstr(rs.recordcount) + "条信息&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"            
if curpage = 1 then             
 response.write "首页 前页 "            
else            
 response.write "<a href='" & request.ServerVariables("script_name") & "?lx=" & request("lx") & "&page=1'>首页</a> <a href='" & request.ServerVariables("script_name") & "?lx=" & request("lx") & "&page=" + cstr(curpage-1) + "'>前页</a> "            
end if
  
if  curpage = rs.pagecount then            
 response.write "后页 末页"            
else            
 response.write "<a href='" & request.ServerVariables("script_name") & "?lx=" & request("lx") & "&page=" + cstr(curpage+1) + "'>后页</a> <a href='" & request.ServerVariables("script_name") & "?lx=" & request("lx") & "&page=" + cstr(rs.pagecount) + "'>末页</a>"            

end if
end if %>
                      转:
                      <select name='page' size='1' onchange='javascript:submit()' class="text1" >
                        <%for i = 1 to cint(rs.pagecount)%>
                        <option value='<%=i%>' <%if cint(request("page"))=cint(i) then%> selected="selected" <%end if%>>第<%=i%>页</option>
                        <%next%>
                      </select>
                    </form>
                  </div>
                  <%rs.close
      set rs=nothing%></td>
              </tr>
             
            </table></td>
            </tr>

posted @ 2011-12-30 10:10  温暖向阳Love  阅读(143)  评论(0编辑  收藏  举报