change_page_content();
function change_page_content() {
// 取得 料
dCount = oSource.children().children().length;
// 示
sPageStr = "<div class='ref'><a href='javascript:void(0)' id='fresh_"
+ fresh_id
+ "' onClick='fresh(this.id);' class='sx' style='color:#247AA9;'><span>刷新</span></a></div>";
sPageStr += " <div class='msdn'><a href='javascript:void(0)'>首页</a><a href='javascript:void(0)'>上一页</a><a href='javascript:void(0)'>下一页</a><a href='javascript:void(0)'>尾页</a></div>";
sPageStr += "<div class='txt'>"+"共"+Math.ceil(dCount / dCountOfPage)+"页,当前第"+"<strong>"+dNowIndex+"</strong>"+"页"+"</div>";
oObj.html(sPageStr);
dPageIndex = 1;
// 表格 容
var rr=oSource.children().children("tr");
oSource.children().children("tr").each(function() {
// ==2
if (dPageIndex >= (((dNowIndex - 1) * dCountOfPage) + 1)
&& dPageIndex <= ((dNowIndex * dCountOfPage) )) {
$(this).show();
} else {
$(this).hide();
}
dPageIndex++;
});
// oSource.children().children("tr").first().show(); // head一定要 示
if(dCount<=dCountOfPage){
var tt=$("#table_page_"+fresh_id).children('.msdn').children().each(function(i) {
if(i==2||i==3||i==0||i==1){
$(this).addClass("disabled");
}
});
}
else if(dNowIndex==Math.ceil(dCount / dCountOfPage)){
var tt=$("#table_page_"+fresh_id).children('.msdn').children().each(function(i) {
if(i==2||i==3){
$(this).addClass("disabled");
}
});
}else if(dNowIndex==1){
var tt=$("#table_page_"+fresh_id).children('.msdn').children().each(function(i) {
if(i==0||i==1){
$(this).addClass("disabled");
}
});
}
// 加入 事件
oObj.children().children().each(function() {
$(this).click(function() {
dNowIndex = $(this)[0].innerHTML;
if (dNowIndex == '首页') {
dNowIndex = 1;
change_page_content();
nowIndex = dNowIndex;
}
if (dNowIndex == '尾页') {
dNowIndex = Math.ceil(dCount / dCountOfPage);
change_page_content();
nowIndex = dNowIndex;
}
if (dNowIndex == '下一页') {
if (nowIndex < Math.ceil(dCount / dCountOfPage)) {
dNowIndex = parseInt(nowIndex) + 1;
change_page_content();
nowIndex = nowIndex + 1;
}
}
if (dNowIndex == '上一页') {
if (nowIndex > 1) {
dNowIndex = parseInt(nowIndex) - 1;
change_page_content();
nowIndex = nowIndex - 1;
}
}
});
});
}
};
})(jQuery);
新闻热点
疑难解答