}
else{
if(parseInt(pageIndex)<(limit-2)){
for(var i=1; i<=limit; i++){
html+=”<a page=”+i+” leaf=’leaf’>”+i+”</a>”;}
html+=”…”;
html+=right(pageCount,limit,rlimit);
}
else{
if(parseInt(pageIndex)%(limit-2)==0){
if(parseInt(pageIndex)/(limit-2)<=change&&parseInt(pageIndex)-1+parseInt(limit)-1<=parseInt(pageCount)-parseInt(rlimit)){
for(var i=parseInt(pageIndex)-1; i<parseInt(pageIndex)-1+limit; i++){
html+=”<a page=”+i+” leaf=’leaf’>”+i+”</a>”;}
html+=”…”;
html+=right(pageCount,limit,rlimit);
}
else{
for(var i=1; i<=rlimit; i++){
html+=”<a page=”+i+” leaf=’leaf’>”+i+”</a>”;}
html+=”…”;
var rest=parseInt(pageCount)-parseInt(rlimit);
if(rest<limit){
for(var i=parseInt(rlimit)+1; i<=parseInt(pageCount); i++){
html+=”<a page=”+i+” leaf=’leaf’>”+i+”</a>”;}
}
else{
var start=parseInt(pageCount)-parseInt(limit)+1;
for(var i=start; i<=pageCount; i++){
html+=”<a page=”+i+” leaf=’leaf’>”+i+”</a>”;}
}
}
}
else{
html=$(“div.pageDivs”).html();
$(“div.pageDivs”).html(html);
isContinue=false;
}
}
}
}
if(isContinue){
html+=”<a id=’Button2′ href=’#’ >></a><a id=’Last’ href=’#’ >>|</a>”;
$(“div.pageDivs”).html(html);}
changeState(pageIndex,pageCount);
$(“div.pageDivs”).find(“a[page=” + parseInt(pageIndex) + “]:visible”).removeAttr(“href”).removeClass(“disabled”).addClass(“current”).siblings(“a[page:visible”).removeClass(“current”).addClass(“disabled”).attr(“href”, “#”);
}
function page(pageIndex){
/////////////这里放你具体的数据显示,使用ajax动态加载处理数据
pageCount=”通过数据处理获得的页面总数”;
span(pageCount,pageIndex,7,2);//对分页效果进行调用,这里设置左边显示7个页码,右边显示2个页码。
}
//////////////////////////////为页码绑定事件
$(“div.pageDivs”).find(“a:visible”).live(“click”,function(){
var result=$(this).attr(“page”);
if((typeof $(this).attr(“leaf”))!= ‘undefined’){
$(this).removeAttr(“href”).removeClass(“disabled”).addClass(“current”).siblings().removeClass(“current”).addClass(“disabled”).attr(“href”,”#”);}










