//分頁通用類
public class pager
private int pageindex;
public int pageindex
get; set;
private int currentpagecount;
public int currentpagecount
get;set;
protected string sbhtml = "";
if(currentpagecount <= 1)//如果就一夜,不顯示分頁
return;
int start = currentpage -5;//表示起始位置。。。一頁有十條
if(start <=1)
start = 1;
int end = start +9;
if(end >currentpagecount)
end = currentpagecount;
start = end -9;
stringbuilder sb = new stringbuilder();
if(currentpage > 1)
for(int i = start;i<= end;i++)
if(i == currentpage)//等於當前頁
else
sbhtml = sb.tostring();
//分頁通用類2
/// a's title
/// the url of a
/// the attribute
/// return html string
/*別人寫的分頁類*/
///2
///生成分頁標籤
3///
4public
class
pager513
private
set14}15
16private
intpagesize;
17///
18///
請求的當前頁的大小
19///
20public
intpagesize
2123
private
set24}25
26private
introwcount;
27///
28///
資料總量,可以根據這個判斷出能夠顯示多少頁
29///
30public
introwcount
3133
private
set34}35
36private
string
hrefformat;
37///
38///
頁碼連線所要指向的url格式化字串例如:aticlelist.aspx?&delegate=wenxue
39///
40public
string
hrefformat
4143
set44}45
private
intpagecount;
4647
private
pager()
4849
public
pager(
intpageindex,
intpagesize,
introwcount)
5058
59public
string
createpager()
6067
else
6871
createpageindex(sb);
72if
(this
.pageindex
<
this
.pagecount)
737677"
");78return
sb.tostring();79}
8081
private
void
createpageindex(stringbuilder sb)
8293
"\t"
+string
.format(hrefformat,
"page="+
i) +
"'>"+
i +""
);94}95
if(i
<
this
.pagecount)
96101
}102
elseif(
this
.pageindex
>
12&&
this
.pagecount
>
this
.pageindex +5
)103
115"
\t"+
string
.format(hrefformat,
"page="+
i) +
"'>"+
i +""
);116
}117
"...");
118for
(intj =
this
.pagecount -2
; j
<=
this
.pagecount; j++)
119122
}123
elseif(
this
.pageindex
>7)
124132
for(; i
<=
(this
.pageindex +4
>
this
.pagecount
?this
.pagecount :
this
.pageindex +4
); i++)
133139
"\t"
+string
.format(hrefformat,
"page="+
i) +
"'>"+
i +""
);140
141}
142if
(i <
this
.pagecount)
143147
}148
}149
150private
intgetpageindex(
intpageindex,
intpagesize,
introwcount)
151157
else
if(pageindex
>
this
.pagecount)
//就讓他等於最大頁碼
158161
else
162165
}166
}css:12
3456
78910
1112
1314
1516
1718
1920
2122
2324
2526
2728
2930
31div.pager a
#pre
#pre.false:hover
#next
div.pager a:hover,div.pager a.active
asp數字分頁函式
function showpage totalnumber,maxperpage,filename dim n if totalnumber mod maxperpage 0 then n totalnumber maxperpage else n totalnumber maxperpage 1 ...
才子分頁類
取文章總數及每頁重複顯示條數,準備分頁 wzcount 文章總數 wzrep 重複顯示條數 wzpage 分頁引數id wzpagecount 總頁數 dim wzcount,wzrep,wzpage,wzpagecount,wzpagerep,boardstr wzrep 30 rssql sel...
簡易分頁類
這是乙個簡單易用的分頁類。只需在你原有的程式中加兩句 改一句就可以了 先貼 paging.php php code phpclass paging static function bar tpl echo tpl 通常你都有類似這樣的語句 sql rs mysql query sql 或 rs my...