ASP 数字分页效果代码(3)


    'close to end only hide early pages
    else
     pagination = pagination &  "<a href="""&targetpage&"&page=1"">1</a>"
     pagination = pagination &  "<a href="""&targetpage&"&page=2"">2</a>"
     pagination = pagination &  "..."
     for counter = (lastpage - (1 + (adjacents * 3))) To lastpage
      if counter = page then
       pagination = pagination &  "<span class=""current"">"&counter&"</span>"
      else
       pagination = pagination &  "<a href="""&targetpage&"&page="&counter&""">"&counter&"</a>"
      end if
     next
    end if
   end if
   'nextPage button
   if page < counter - 1 then
    pagination = pagination &  "<a href="""&targetpage&"&page="&nextPage&""">Next</a>"
   else
    pagination = pagination &  "<span class=""disabled"">Next</span>"
   end if
   pagination = pagination &  "</div>" & vbnewline
  end if
  getPaginationString = pagination
 end function
 function Ceil( dividend, divider)
  if (dividend mod divider) = 0 Then
   Ceil = dividend / divider
  ELSE
   Ceil = Int(dividend / divider) + 1
  End if
    End function
 'test script code
 page = 1
 if request("page") <> "" then
  page=cint(request("page"))
 end if
 ps = getPaginationString(page, 1500, 15, 2, "pagination.asp?foo=bar")
 Response.Write("<br /><br /><br /><br /><br /><br /><br /><br />"&ps)
%>


完整打包代码:pagination(jb51.net).rar

看了有些头晕,还是看点简单的吧,asp与php思想差不多啊,参考了dedecms的修改方法

效果图:

核心代码:

复制代码 代码如下:

ps=cint(pageno)-2           
  if ps<1 then           
  ps=1           
  end if
pe=clng(pageno)+5
if pe>mpage then pe=mpage
for i=ps to pe
if i=pageno then
lb=lb&"<strong>"&i&"</strong>"
else

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/2233.html