blog_id = 153248
login_uid =
author_uid = 567839
is_check= true
isRecommend= false
oscer=
is_red = false
原创
2013/08/17 01:29
阅读数 3.2K
002 |
var pageNumber = page.pageNumber; // 当前页 |
003 |
var totalPage = page.totalPage; // 总页数 |
004 |
var num_display_entries = 11; // 每次显示多少页 |
005 |
var num_edge_entries = 2; // 前后各多少页 |
006 |
var ellipse_text = "..."; |
007 |
// uri地址 如果不是/结束的 那么就表示带有参数,使用res风格 |
008 |
if (!strutil.endWith(uri,"/")) { |
012 |
if (page.totalRow > page.pageSize) { |
014 |
<div class="pagin clearfix"> |
015 |
<div class="pagin-head"> |
018 |
if(pageNumber != 1) { |
019 |
printf("<a href='%s%s'><</a>",uri,pageNumber-1); |
021 |
printf("<span class='current prve'><</span>"); |
024 |
//printf(" <span class='current'>%s</span>",pageNumber); |
027 |
if(pageNumber != totalPage) { |
028 |
printf(" <a href='%s%s'>></a>",uri,pageNumber+1); |
030 |
printf(" <span class='current next'>></span>"); |
034 |
<div class="pagin-body"> |
036 |
// 总页数大于 (显示的页数+前后显示) 表示需要显示很多页 |
037 |
var pageCount = totalPage - (num_display_entries + num_edge_entries * 2); |
041 |
var _start = trunc(num_display_entries / 2); |
043 |
if (num_display_entries%2 == 0) { |
048 |
if (pageNumber - _start - num_edge_entries >= num_edge_entries) { |
049 |
while(i < num_edge_entries + 1) { |
050 |
printf("<a href='%s%s'>%s</a> ",uri,i,i); |
053 |
printf("<span>%s</span> ",ellipse_text); |
055 |
i = pageNumber-_start; |
056 |
len = pageNumber + _end+1; |
058 |
len = num_display_entries+1; |
061 |
var show_num_edge_entries_next = totalPage - pageNumber - _end - num_edge_entries > 0; |
062 |
if (!show_num_edge_entries_next) { |
063 |
i = pageNumber - _start; |
064 |
if (totalPage - pageNumber - _end < 0) { |
065 |
i = totalPage - num_display_entries+1; |
072 |
if (pageNumber == i) { |
073 |
printf("<span class='current'>%s</span> ",i); |
075 |
printf("<a href='%s%s'>%s</a> ",uri,i,i); |
081 |
if (show_num_edge_entries_next) { |
082 |
printf("<span>%s</span> ",ellipse_text); |
083 |
i = totalPage + 1 - num_edge_entries; |
084 |
while(i < totalPage + 1) { |
085 |
printf("<a href='%s%s'>%s</a> ",uri,i,i); |
092 |
while(i < totalPage + 1) { |
093 |
if (pageNumber == i) { |
094 |
printf("<span class='current'>%s</span> ",i); |
096 |
printf("<a href='%s%s'>%s</a> ",uri,i,i); |
展开阅读全文