四虎精品视频-四虎精品成人免费网站-四虎黄色网-四虎国产视频-国产免费91-国产蜜臀97一区二区三区

基于jQuery的js分頁代碼

復制代碼 代碼如下:
function pagerBar(dataCount,pageSize,serverUrl,contentPlace,pagerbarPlace,callBack){
this.dataCount = dataCount;
this.pageSize = pageSize;
this.serverUrl = serverUrl;
this.contentPlace = $("#"+contentPlace);
this.pagerbarPlace = $("#"+pagerbarPlace);
this.callBack = callBack;

this.pageCount = 0;
this.pageIndex = 1;
this.curInfo = $("<span/>");
this.prePage = $("<span/>");
this.nextPage = $("<span/>");
this.init();
}
pagerBar.prototype = {
init : function(){
this.getPageCount();
this.initLink();
this.showBarInfo();
if(this.pageCount>0){
this.setLink(1);
}
},
getPageCount : function(){
this.pageCount = parseInt(this.dataCount / this.pageSize);
if(this.dataCount % this.pageSize !=0){
this.pageCount++;
}
},
initLink : function(){
var self = this;
this.prePage = $("<span/>").html("").addClass("pageLink");
this.prePage.click(function(){
self.setLink(self.pageIndex-1);
});
this.nextPage = $("<span/>").html("").addClass("pageLink");
this.nextPage.click(function(){
self.setLink(self.pageIndex+1);
});
this.pagerbarPlace.append(this.curInfo).append(this.prePage).append(this.nextPage);
},
showBarInfo : function(){
this.prePage.hide();
this.nextPage.hide();

if(this.pageCount==0){
this.curInfo.html("暫時沒有信息!");
}
else if(this.pageCount==1){
this.curInfo.html("1/1");
}
else{
this.curInfo.html(this.pageCount + "/" + this.pageIndex);
}

},
setLink : function(i){
var self = this;
$.ajax({
url:self.serverUrl,
type:"get",
data:{pageSize:self.pageSize,pageIndex:i},
cache:false,
error:function(){
alert("數據加載失敗!");
},
success:function(htmlData){
self.contentPlace.html(htmlData);
if(self.pageCount==1){
self.prePage.hide();
self.nextPage.hide();
}else{
if(i==1){
self.prePage.hide();
self.nextPage.show();
}else if(i==self.pageCount){
self.prePage.show();
self.nextPage.hide();
}else{
self.prePage.show();
self.nextPage.show();
}
}
self.pageIndex = i;
self.curInfo.html(self.pageCount+"/"+self.pageIndex);
if(self.callBack){
self.callBack();
}
}
});
},
changeServerUrl : function(dataCount,serverUrl){
this.dataCount = dataCount;
this.serverUrl = serverUrl;
this.pageIndex=1;

this.getPageCount();
this.showBarInfo();
this.contentPlace.html("");
if(this.pageCount>0){
this.setLink(1);
}
},
dataCountDec : function(){
this.dataCount--;
this.getPageCount();
if(this.pageCount<this.pageIndex){
this.pageIndex = this.pageCount;
}
if(this.pageIndex>0){
this.setLink(this.pageIndex);
}
this.showBarInfo();
}
}

JavaScript技術基于jQuery的js分頁代碼,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 救急战队| 保镖1993电视剧正版免费观看| 凯特摩丝| 中国安全生产报| 爱神的诱惑| 檀健次壁纸| 麻花影业| 凌晨晚餐| 封顶仪式| 艳女十八式无删减版| 电影《年龄差》| 琅琊榜豆瓣评分| 八哥图库图谜| 美女拉屎| 包天笑| 张国强个人简历| 卡五星怎么算账| 鲍鱼视频在线观看| 何丽萍| 浙江卫视直播在线观看高清电视台| 成年奶妈| 不扣纽的女孩| 秀人网周妍希| 美丽的邂逅| 韩伦理| 吴彦祖激情戏| 碟仙诡谭| 湿身美女| 贾宏| 哪吒电影1| 快播王欣| 性丑闻| 极寒之城在线观看高清完整 | 丰满妇女做a级毛片免费观看| 团结就是力量歌词完整版图片| 脚心的视频vk| 七十二小时| 3d成人国产同人动漫焰灵姬| 丧尸童子军| 艳肉观世音性三级| 髋关节置换术后护理ppt|