国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

ASP 數字分頁效果代碼

2024-05-04 10:59:36
字體:
來源:轉載
供稿:網友
最近網站改版正好發現原來的分頁不帶數字的,只有首頁 上頁 下頁 末頁 然后是select的跳轉,都是以前比較流行的,而現在比較流行的是數字分頁在中間,正好研究并分享下,需要的朋友可以參考下

效果:



國外的核心代碼:

復制代碼 代碼如下:
<%
 'digg style pagination script in asp.. written by Moazam... http://www.moazam.com/2007/03/30/asp-digg-style-pagination-script/

 function getPaginationString(page, totalitems, limit, adjacents, targetpage) 
  'defaults
  if not isnumeric(adjacents) then adjacents = 1 end if
  if not isnumeric(limit) then  limit = 15 end if
  if not isnumeric(page) then page = 1 end if
  if targetpage = "" then targetpage = "/" end if
  margin = ""
  padding=""
  'other vars
  prev = page - 1         'previous page is page - 1
  nextPage = page + 1         'nextPage page is page + 1
  lastpage = Ceil(totalitems , limit)    'lastpage is = total items / items per page, rounded up.
  lpm1 = lastpage - 1        'last page minus 1
  ' Now we apply our rules and draw the pagination object.
  ' We're actually saving the code to a variable in case we want to draw it more than once.

  pagination = ""
  if lastpage > 1 then

   pagination = pagination & "<div class=""pagination"""
   if margin <> "" OR padding <> "" then
    pagination = pagination &  " style="""
    if margin <> "" then
     pagination = pagination &  "margin: margin"
    end if
    if padding <> "" then
     pagination = pagination &  "padding: padding"
    end if
    pagination = pagination &  """"
   end if
   pagination = pagination &  ">"

   'previous button
   if page > 1 then
    pagination = pagination &  "<a href="""&targetpage&"&page="&prev&""">Prev</a>"
   else
    pagination = pagination &  "<span class=""disabled"">Prev</span>" 
   end if
   'pages 
   if lastpage < 7 + (adjacents * 2) then 'not enough pages to bother breaking it up

    for counter = 1 to lastpage

     if counter = page then

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 章丘市| 陵川县| 应城市| 武强县| 攀枝花市| 石屏县| 登封市| 彰武县| 昌宁县| 桦甸市| 江阴市| 桃源县| 江达县| 澄迈县| 喜德县| 龙南县| 全南县| 交口县| 睢宁县| 石阡县| 石首市| 汾西县| 加查县| 嘉兴市| 宜都市| 德钦县| 阳原县| 崇阳县| 剑阁县| 晴隆县| 措勤县| 华宁县| 洪泽县| 墨江| 佛教| 白河县| 固镇县| 资源县| 平遥县| 尉氏县| 马山县|