zoukankan      html  css  js  c++  java
  • ASP分頁Function

     

        Public Sub Pagination2(PageCount,UrlStr = "")
            Dim WzPage, PageNum
            If UrlStr = "" Then
                If Len(Request("Page")) <> 0 Then
                    WzPage = CLng(Request("Page"))
                Else
                    WzPage = 1
                End If

                If WzPage <= 0 Then WzPage = 1

                PageNum = (WzPage \ 10) * 10 + 1

                If WzPage Mod 10 = 0 Then PageNum = (WzPage \ 10) * 10 - 9
                Response.Write("<font face=""Webdings"">")
                Response.Write("<a href=""?Page=1"" title=""首頁"">9</a>")
                Response.Write("<a href=""?Page=" & PageNum - 1 & """ title=""前十頁"">7</a>")
                Response.Write("</font><font face=""Arial"">")
                For PageNum = PageNum To PageNum + 9
                    If PageNum = WzPage Then
                        Response.Write("<b>")
                        Response.Write(" [" & PageNum & "] ")
                        Response.Write("</b>")
                    Else
                        Response.Write(" <a href=""?Page=" & PageNum & """>")
                        Response.Write("" & PageNum & "")
                        Response.Write("</a> ")
                    End If
                    If PageNum >= PageCount Then Exit For
                Next
                Response.Write("</font><font face=""Webdings"">")
                Response.Write("<a href=""?Page=" & PageNum & """  title=""後十頁"">8</a>")
                Response.Write("<a href=""?Page=" & PageCount & """  title=""尾頁"">:</a>")
                Response.Write("</font>")
            Else
                If Len(Request("Page")) <> 0 Then
                    WzPage = CLng(Request("Page"))
                Else
                    WzPage = 1
                End If

                If WzPage <= 0 Then WzPage = 1

                PageNum = (WzPage \ 10) * 10 + 1

                If WzPage Mod 10 = 0 Then PageNum = (WzPage \ 10) * 10 - 9
                Response.Write("<font face=""Webdings"">")
                Response.Write("<a href=""?" & UrlStr & "&Page=1"" title=""首頁"">9</a>")
                Response.Write("<a href=""?" & UrlStr & "&Page=" & PageNum - 1 & """ title=""前十頁"">7</a>")
                Response.Write("</font><font face=""Arial"">")
                For PageNum = PageNum To PageNum + 9
                    If PageNum = WzPage Then
                        Response.Write("<b>")
                        Response.Write(" [" & PageNum & "] ")
                        Response.Write("</b>")
                    Else
                        Response.Write(" <a href=""?" & UrlStr & "&Page=" & PageNum & """>")
                        Response.Write("" & PageNum & "")
                        Response.Write("</a> ")
                    End If
                    If PageNum >= PageCount Then Exit For
                Next
                Response.Write("</font><font face=""Webdings"">")
                Response.Write("<a href=""?" & UrlStr & "&Page=" & PageNum & """  title=""後十頁"">8</a>")
                Response.Write("<a href=""?" & UrlStr & "&Page=" & PageCount & """  title=""尾頁"">:</a>")
                Response.Write("</font>")
            End If
        End Sub

    申明

    非源创博文中的内容均收集自网上,若有侵权之处,请及时联络,我会在第一时间内删除.再次说声抱歉!!!

    博文欢迎转载,但请给出原文连接。

  • 相关阅读:
    如何编写一个有效的缓存
    [深入Maven源代码]maven绑定命令行参数到具体插件
    java.util.ServiceLoader的用法
    非阻塞算法-栈
    非阻塞算法-简单的计数器
    Excelbatis-一个将excel文件读入成实体列表、将实体列表解析成excel文件的ORM框架,简洁易于配置、可扩展性好
    教你如何迭代地遍历二叉树
    [开源项目]Shell4Win,一个在Windows下执行shell命令的解释器
    [LeetCode]Single Number II
    CAS5.3服务环境搭建
  • 原文地址:https://www.cnblogs.com/Athrun/p/554437.html
Copyright © 2011-2022 走看看