惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Help Net Security
Help Net Security
G
Google Developers Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
F
Full Disclosure
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
U
Unit 42
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
C
Cisco Blogs
博客园 - 司徒正美
Project Zero
Project Zero
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
Scott Helme
Scott Helme
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyberwarzone
Cyberwarzone
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
T
Threatpost
Recorded Future
Recorded Future
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
S
Security Archives - TechRepublic
博客园 - Franky
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
W
WeLiveSecurity
A
Arctic Wolf
B
Blog

博客园 - laopu

男人最让女人感动的一句粗话 手机解锁,各种手机解锁大全指令 检查sql字符串中是否有单引号,有则进行转化 如何从一个字符串中提取数字部分 asp标示及命令集合 asp.net常用函数表 SQL安装被挂起的修复 ASP动态网页生成静态Html网页文件技术 ASP网站漏洞及入侵防范方法 asp.net中的MD5加密 asp中时间比较DateDiff ASP与SQL数据库连接及SQL常用命令使用方法 ASP连接Access数据库几种常见方法以及简单操作教程 非常漂亮的flv在线播放器代码 非常漂亮的flv在线播放器代码 wmv在线播放器代码 real在线播放器代码 asp 判断浏览器类型 如何成为一个篮球高手
asp分页代码(最实用的)
laopu · 2007-11-22 · via 博客园 - laopu

asp分页代码(最实用的)


平时常用的分页代码!放上去备忘啊,每次用都要找,老是记不住,现在copy一下,改改参数就可以了!
分页代码一
<%
page=request("page")
count=rs.recordcount
if count<1 then
response.write "<br />
<center>数据库中没有资料!</center>"
response.end
end if
'分页处理
const size = 12
rs.pagesize=size
totlepage=int(count/size)
if (count mod size)>0 then totlepage=totlepage+1
if len(page)>0 and isnumeric(page) then
page =int(page)
else
if page="" then page=1
if page>totlepage then
page =totlepage
else
page=1
end if
end if
if page>totlepage then page=totlepage
if page<1 then page=1
position=rs.PageSize*Page
pagebegin=position-rs.PageSize+1
rs.absoluteposition=pagebegin
%>
<table cellspacing="0" cellpadding="0" width="550" align="center" border="0">
    <tbody>
        <tr>
            <td>
            <div align="center">
            <table cellspacing="2" cellpadding="3" width="100%" border="0">
                <tbody>
                    <tr bgcolor="#c0c0c0">
                        <td width="10%" bgcolor="#c0c0c0" height="25">
                        <div align="center">ID</div>
                        </td>
                        <td width="67%">
                        <div align="center">新闻标题</div>
                        </td>
                        <td width="10%">
                        <div align="center">操作</div>
                        </td>
                        <td width="13%">
                        <div align="center">操作</div>
                        </td>
                    </tr>
                    <%i=0%><%do while not rs.eof and i<size%>
                    <tr bgcolor="#e3e3e3">
                        <td height="22">
                        <div align="center"><%=rs("id")%></div>
                        </td>
                        <td><%=rs("title")%></td>
                        <td bgcolor="#e3e3e3">
                        <div align="center"><A href="admin_news.asp?id=<%=rs(" id?)%>&amp;update=update"&gt;修改</a></div>
                        </td>
                        <td>
                        <div align="center"><A href="admin_News.asp?id=<%=rs(" id?)%>&amp;delete=1"&gt;删除</a></div>
                        </td>
                    </tr>
                    <% rs.movenext()
                    i=i+1
                    loop %>
                    <tr align="center" bgcolor="#c0c0c0">
                        <td colspan="4" height="25">
                        <table cellspacing="0" cellpadding="0" width="100%" border="0">
                            <tbody>
                                <tr>
                                    <td class="black30" align="right" width="57%">当前第<%=page%>页     <%if page>1 then%><A href="admin_news.asp?page=<%=page-1%>">上一页</a> <%else if page=1 then%><a>上一页</a> <%end if%><%end if%><%if page<totlepage then%><A href="admin_news.asp?page=<%=page+1%>">下一页</a> <%else if page=totlepage then%><a>下一页</a> <%end if%><%end if%></td>
                                    <td align="center" width="43%">共<%=totlepage%>页<%=count%>条新闻 </td>
                                </tr>
                            </tbody>
                        </table>
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 分页代码2
                        <table cellspacing="0" cellpadding="0" width="93%" align="center" border="0">
                            <%
                            If rs.RecordCount >0 Then
                            rs.PageSize=20
                            rs.AbsolutePage=1
                            nextpage=2
                            lastpage=1
                            nowpage=1
                            if Request("page")<>"" then
                            rs.AbsolutePage =request("page")
                            nowpage=request("page")
                            nextpage=request("page")+1
                            lastpage=request("page")-1
                            end if
                            rowcount=rs.PageSize
                            endpage=rs.PageCount
                            while not rs.EOF  and rowcount>0
                            %>
                            <tbody>
                                <tr>
                                    <td width="3%"><img height="12" alt="" src="images/tb.gif" width="13" /></td>
                                    <td class="blue121" width="86%" height="30"><A class=blue121 onclick="window.open('gonggao_tc.asp?NewsID=<%=rs(" href="#" NewsID?)%>','','width=570,height=480,scrollbars=yes')"&gt;<%=rs("title")%></a></td>
                                    <td class="00629C_11" valign="middle" align="left" width="11%"><%=Formatdatetime(rs("AddDate"),2)%></td>
                                </tr>
                                <%
                                rs.MoveNext
                                rowcount=rowcount-1
                                wend
                                if nextpage>rs.PageCount then
                                nextpage=rs.PageCount
                                end if
                                if lastpage<1 then
                                lastpage=1
                                end if
                                End if
                                %>
                            </tbody>
                        </table>
                        <table cellspacing="0" cellpadding="0" width="90%" align="center" border="0">
                            <tbody>
                                <tr>
                                    <td class="black6666661" valign="middle" align="right" height="40"><a class="black12" href="gonggao.asp?Page=1">首页</a> <A class=black12 href="gonggao.asp?Page=<%=lastpage%>">上一页</a> <A class=black12 href="gonggao.asp?Page=<%=nextpage%>">下一页</a> <A class=black12 href="gonggao.asp?Page=<%=rs.PageCount%>">尾页</a>  <span class="black12">页次:</span><span class="black12"><strong><font color="red"><%=nowpage%></font></strong>/<strong><font color="red"><%=endpage%></font></strong>页</span>     <span class="black12">转到: <script language="JavaScript">
      function jump(m)
      {
      window.location.href=m
      }
      </script><select onchange="jump(this.value)" name="jump">
                                    <option value=""  selected></option>
                                    <OPTION value="gonggao.asp?page=<%=i%>"></option>
                                    </select> 页</span> </td>
                                </tr>
                            </tbody>
                        </table>
                        </td>
                    </tr>
                </tbody>
                <div></div>
            </tr>
        </tbody>
    </table>
    </div>
</tr>
</tbody>
</table>

posted on 2007-11-22 15:13  laopu  阅读(653)  评论()    收藏  举报