curPage=parseInt(page_val);
//每次选择要重新处理按钮
handleBtn();
//响应点击事件
callback(curPage);
}
}
function handleBtn(){
//首页是否有效
var first = page_ul.firstChild;
if(curPage===1){
handleClass(first,btn_dislabel,‘add’);
}else{
handleClass(first,btn_dislabel,‘del’);
}
//前一页按钮是否有效
var prev = first.nextSibling;
if(curPage===1){
handleClass(prev,btn_dislabel,‘add’);
}else{
handleClass(prev,btn_dislabel,‘del’);
}
//nav_rela
if(curPage===1){
leftCount=0;
}else{
nav_rela = curPage-nav_mid;
leftCount = (leftCount+ nav_rela)>0?(leftCount+ nav_rela):0;
nav_mid += nav_rela;
}
if(curPage===totalPage){
rightCount=0;
}else{
rightCount = totalPage-nav_count-leftCount;//右边隐藏节点数
}
//选择当前页
for(var i=1;i<=totalPage; i++){
var page=(i+1);
if(i==curPage){//选择当前页
if(curPage=1 || curPage=totalPage){
handleClass(page_ul.childNodes[page],btn_hide,‘del’);
}
handleClass(page_ul.childNodes[page],btn_