分页和批量操作前台代码

来源:互联网 发布:pubmed数据库检索式 编辑:程序博客网 时间:2024/06/06 02:45

//分页var myPagination=function(obj,fn){  //清除事件  $(".next-page").css('cursor','').unbind("click");   $(".tail-page").css('cursor','').unbind("click");   $(".pre-page").css('cursor','').unbind("click");   $(".index-page").css('cursor','').unbind("click");   $(".go-page").find("input").unbind("keyup");   $(".total-page").html("总共"+obj.totalPage+"页");  $(".current-page").html("当前第"+obj.pageNumber+"页");  if(!obj.firstPage){//是不是第一页    $(".index-page").css('cursor','pointer').click(function(){fn(1)});    $(".pre-page").css('cursor','pointer').click(function(){fn(obj.pageNumber-1)});  }else{    $(".pre-page").css('cursor','').unbind("click"); //移除click事件    $(".index-page").css('cursor','').unbind("click"); //移除click事件  }  if(!obj.lastPage){//是不是最后一页    $(".next-page").css('cursor','pointer').click(function(){fn(obj.pageNumber+1)});    $(".tail-page").css('cursor','pointer').click(function(){fn(obj.totalPage)});  }else{    $(".next-page").css('cursor','').unbind("click"); //移除click事件    $(".tail-page").css('cursor','').unbind("click"); //移除click事件   }  $(".go-page").find("input").keyup(function(){    if(event.keyCode == 13){      if(($(this).val()>obj.totalPage||$(this).val()<1)&&!isInteger($(this).val())){        Dialog.show("请输入1-"+obj.totalPage,function(){  Dialog.hide();        });      }else{  fn($(this).val());      }    }   });}function isInteger(obj) {  return parseInt(obj) == obj;}//批量操作var getIds=function(){  //获取id  var checkstr="";  $(".article-id:checked").each(function(i){    if(checkstr!=""){      checkstr+=",";    }    checkstr+=$(this).attr("data-id");  });  return checkstr; }



0 0