bootstrap分页

前台界面写上这个隐藏域

<input type="hidden" id="NotReadPage">

js界面

初始化方法

var pageNumber=1;//设置显示第几页
    if(!isNaN(id)){
        pageNumber=id;
    }
    if(id==(-2)){
        pageNumber=parseInt($("#NotReadPage").val())-1;
    }else if(id==(-1)){
        pageNumber=parseInt($("#NotReadPage").val())+1;
    }

查询方法接受之为hashmap

url:appPath+'/list',
        data:{pageNumber:pageNumber,pageSize:'5'},
        success:function(data){}
         str+="<div class='dataTables_paginate paging_bootstrap pagination pagination-big'style='text-align:center'>";
            if(pageNumber==1){
                str+="<ul><li class='prev disabled'><a >上一页</a></li>";
            }else{
                str+="<ul><li class='prev'><a onclick='doQuery("+(-2)+")'>上一页</a></li>";
            }
            var j=1;
            for(j;j<=size;j++){
                if(j==pageNumber){
                    str+="<li class='active'><a >"+j+"</a></li>";
                }else{
                    str+="<li><a onclick='doQuery("+j+")'>"+j+"</a></li>";
                }
             }
            //如果当只有一页则都禁止,如果当前页等于跳的页则禁止,其他情况不禁止使用
             if(pageNumber>=size){
                 str+="<li class='next disabled'><a>下一页</a></li></ul></div></div>";
             }else{
                 str+="<li class='next'><a onclick='doQuery("+(-1)+")'>下一页</a></li></ul></div></div>";
             }
             $("#NotReadPage").val(pageNumber);


你可能感兴趣的:(bootstrap分页)