国产探花免费观看_亚洲丰满少妇自慰呻吟_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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 罗定市| 繁昌县| 黄龙县| 江永县| 德州市| 乐亭县| 桐柏县| 天全县| 汉源县| 孟津县| 金溪县| 图木舒克市| 连州市| 重庆市| 青铜峡市| 苏尼特右旗| 繁昌县| 巴马| 霸州市| 双鸭山市| 白玉县| 剑阁县| 扬州市| 左贡县| 榆树市| 修水县| 同心县| 张家港市| 武冈市| 修武县| 柳河县| 中超| 资中县| 黄山市| 淮安市| 宜川县| 若尔盖县| 阳西县| 吉木萨尔县| 高要市| 碌曲县|