效果:
html:
>
用法:
複製程式碼
複製程式碼
複製程式碼
程式碼如下:
var otherParam = "&name='www'&order='time'";
$(function(){
paginate();//分頁}
);
css:
複製程式碼
程式碼如下:
程式碼如下:
>#page{
font-size: 14px;
clear: both;
padding-top: 1.45em;
white-space: nowrap;
}
#page a{
background: white;
border: 1px solid #E7ECF0;
display: inline-block;
}
#pagePre,#pageNext{
}
.pageCurrent{
font-weight: bold;
}
js:
js:
複製程式碼
程式碼如下:
function mcPaginate(){
var $pageDiv = $("#page");
var $pageDiv = $("#page"); 🎜>actionName = actionName "?pageSize=" pageSize;
if(typeof otherParam != 'undefined' && otherParam != ""){
actionName = actionName otherParam>;
$pageDiv.append("第" pageNo "頁/共" pageCount "頁");
//上一頁
if(pageNo > 1){
var hf = actionName "&pageNo=" (pageNo-1);
$pageDiv.append("
" "上一頁" " a>");
};
if(pageCount for(var i=0; i var hf = actionName "&pageNo =" (i 1);
if(pageNo == (i 1)){//目前頁
$pageDiv.append("" pageNo "");
}else{
$pageDiv.append("
" (i 1) "");
};
};
}else{
for(var i=0; i var midIndex = 0;
if(pageSize%2 == 0) {
midIndex = pageSize/2 - 1;
}else{
midIndex = pageSize/2;
}
var num = -midIndex;
var showPageNum = page i num;
if(showPageNum > 0 && showPageNum var hf = actionName "&pageNo=" showPageNum; if(pageNoum== show/Num;當前頁$pageDiv.append("
" showPageNum ""); }else{ $pageDiv.append( "
" showPageNum ""); }; }; }; } //下一頁if(pageNo var hf = actionName "&pageNo=" (pageNo 1); $pageDiv.append("
" "下一頁" ""); }; $pageDiv.append("轉到" "
頁
"); $( ".goButton").click(function(){ var goNum = $(".goNum").val(); if(goNum!=""){ window.location.href = actionName "&pageNo=" goNum; } }); };