设为首页
加入收藏
帮助中心
首页 | 红盾通告 | 信息中心 | ASP技术 | 数据库 | 网页设计 | 网管专栏 | OICQ攻略 | 墨客频道 | 网站运营 |
当前位置:首页 >> ASP技术 >> ASP基础 >> 正文
最新信息
·关于Response.ContentType…
·Request.ServerVariables参…
·让你知道codepage的重要
·Global.asa文件用法大全
·FormatCurrency函数详细用…
·使用Formatnumber()与Form…
·FormatDateTime函数的详细…
·Record记录集的操作方法
·在ASP中使用数据库
·ASP六大对象介绍
资料搜索
热点信息
·如何使Asp页面强制清除缓存…
·常用ASCII 码对照表
·使用Formatnumber()与Form…
·让你知道codepage的重要
·FormatDateTime函数的详细…
·FormatCurrency函数详细用…
·ASP错误代码总结
·Record记录集的操作方法
·Request.ServerVariables参…
·Global.asa文件用法大全
推荐信息
·(ADODB.Command)对象的用法…
·ASP错误代码总结
·ASP教程之ASP基础简介
·ASP VBScript 函数速查表
·关于Response.ContentType…
·Request.ServerVariables参…
·asp关键字函数运算附
·Asp基础教程(上)
·ADO 物件的方法與屬性
·常用ASCII 码对照表


Google
 
ASP分页实例
〖编辑:Cloudy | 浏览:人次〗

<html>
<head>
<title>page</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/css.css" type="text/css">
<script language="javascript">
var winH=window.screen.height -58;
var winW=window.screen.width -10;
</script>

</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0">

<%

Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open Application("Conn")


sql="select * from ART"

pgsz=10   '//------------------這里是分頁記錄條數---------------
set rs=server.CreateObject ("adodb.recordset")
RS.open sql,Conn,1,1

 If rs.RecordCount =0  then
 response.write "<P align=center class=font><br><font size=2 color=red>No record</font></P>" 
 response.end
 else
 
  rs.PageSize =cint(pgsz)
  if rs.RecordCount/pgsz=int(rs.RecordCount/pgsz) then
  total=rs.RecordCount/pgsz
  else
  total=int(rs.RecordCount/pgsz)+1
  end if
  scrollaction=Request("scrollaction")


    if request("pageno")<>"" then
    pageno=request("pageno")
    else
    pageno=pageno
       end if

   if request("pageno_go")<>"" then
   pageno=request("pageno_go")
   end if

          if pageno="" then
          pageno=1
          else
          pageno=pageno+1
          pageno=pageno-1
          end if
                 
          if scrollaction="上一页" then
          pageno=pageno-1
          end if
          if scrollaction="下一页" then
          pageno=pageno+1
          end if
          if pageno<1 then
          pageno=1
          end if
        
      rs.AbsolutePage =pageno
      position=rs.PageSize *pageno
      pagebegin=position-rs.PageSize +1
     
      if position<rs.RecordCount then
      pagend=position
      else
      pagend=rs.RecordCount
      end if
     
%>
<form method="get" action="news.asp">
 
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="52%" height="16"><div align="right">共计<font color=#0000ff><%=rs.RecordCount %></font>篇文章 | 显示﹕<font color=#0000ff><%=pagebegin%>-<%=pagend%></font>条 | 第<font color=#0000ff><%=pageno%></font>/<font color=#0000ff><%=total%></font>页
      </div></td>
    <td width="4%"><div align="left"></div></td>
      <td width="44%"><font size="2">  </font> <font size="2">  </font> </td>
  </tr>
</table>
 
<table width="577" border="0" cellspacing="0" cellpadding="0" height="37" align="center" class="Mtable">
  <tr bgcolor="#CCCCCC">
    <td width="90" height="18"><div align="center"><font size="2">修改/删除</font></div></td>
    <td width="79"><div align="center"><font size="2">主题</font></div></td>
    <td width="79"><div align="center"><font size="2">文章来源</font></div></td>
    <td width="96"><div align="center"><font size="2">文章作者</font></div></td>
    <td width="134"><div align="center"><font color="#000000" size="2">最近编辑时间</font></div></td>
    <td width="85"><div align="center"><font size="2">预览文件</font></div></td>
    <%
do while not (rs is nothing)
rowcount=rs.PageSize
do while not rs.EOF and rowcount>0
%>
  <tr width="450" onmouseover=javascript:bgColor='#EEEEEE' onmouseout=javascript:bgColor='#FFFFFF' style='cursor:default'>
    <td width=90 ><div align="center"> <font size="2">
        <input type="button" name="button3" value="修改" onClick="self.location='news/modify_art.asp?pid=<%=rs("pid")%>'" class="button">
        <input type="button" name="button" value="删除" onclick="javascript:if (confirm('是否真的删除这篇新闻文章?')){window.location.href='news.asp?pid=<%=rs("pid")%>&del=ok'}" class="button">
        </font></div></td>
    <td width=79> <div align="center"><font size="2" face="Times New Roman, Times, serif"><%=rs("TITLE")%></font></div></td>
    <td width=79> <div align="center"><font size="2"><%=rs("ARTFROM")%></font></div></td>
    <td width=96> <div align="center"><font size="2"><%=rs("ARTWRITER")%></font></div></td>
    <td width=134> <div align="center"><font size="2"><%=rs("LASTEDITTIME")%></font></div></td>
    <td width=85> <div align="center"><font size="2">
        <input type="button" name="button32" value="预览" onClick=javascript:window.open('news/preview_art.asp?pid=<%=rs("pid")%>','help','top=0,left=0,toolbar=no,resizable=no,menubar=no,scrollbars=yes, location=no,status=no,width='+winW+',height='+winH+'') class="button">
 </td>
  </tr>
  <%
  rowcount=rowcount-1
  rs.movenext
  loop
  set rs=rs.NextRecordset
  loop

  conn.Close
  set rs=nothing
  set conn=nothing
%>
</table>
   <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
         
      <td height="15"><input type="hidden" name="bm" value="<%=request("bm")%>">
   <input type="hidden" name="dq" value="<%=request("dq")%>"></td>
        </tr>
 </table>
  <div align="center">
  <%
Response.Write "<div align=center>"
Response.Write "<input type=hidden name=pageno value="&pageno&">"
Response.Write "<input type=hidden name=zt value="&zt&">"
Response.Write "<input type=hidden name=tj value="&tj&">"
nr=replace(nr,"""","")
Response.Write "<input type=hidden name=nr value="&nr&">"
if pageno>1 then
Response.Write "<input type=submit name=scrollaction value=上一页 class=button>"
end if
if rowcount=0 and pageno<>total then
Response.Write "  <input type=submit name=scrollaction value=下一页 class=button>"
end if
if total>1 then
%>
   <font size="2">第</font>
  <select name="pageno_goto" onChange="MM_jumpMenu('self',this,0)">
    <%for j=1 to total
 if j=clng(pageno)  then
%>
    <option value="news.asp?pageno_go=<%=j%>&zt=<%=zt%>&tj=<%=tj%>&nr=<%=nr%>&px=<%=px%>&px_mode=<%=px_mode%>" selected><%=j%></option>
    <%else%>
    <option value="news.asp?pageno_go=<%=j%>&zt=<%=zt%>&tj=<%=tj%>&nr=<%=nr%>&px=<%=px%>&px_mode=<%=px_mode%>"><%=j%></option>
    <%end if
next%>
  </select>
  <font size="2">页</font>
  <%end if
end if
%>
</form>
<%
response.write "</div>"
set rs=nothing
set conn=nothing
%>

</body>
</html>


录入时间:2006-07-27 15:15:06 [打印本页] [关闭窗口] [返回顶部]
特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。

Copyright © 2006-2014 0733168.Com Inc All Rights Reserved
关于我们 | 广告合作 | 联系我们 | 法律声明 | 友情链接 | 意见反馈
本站所收录信息、社区话题、及本站所做之广告均属其个人行为,与本站立场无关
湘ICP备06008436号