function getparameter(name) { var reg = new regexp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r!=null) return unescape(r[2]); return null; } //init param:"&2" function commonpage(totalpage,totalrecords,url,param){ var totalpage = totalpage; var totalrecords = totalrecords; var pageno = getparameter('page'); if(!pageno){ pageno = 1; } if(totalpage<2 && pageno==1){ return false; }else if(pageno>totalpage){ pageno=totalpage; if(pageno==1 || pageno==0){ return false; } }else{ } //生成分页 //有些参数是可选的,比如lang,若不传有默认值 kkpager.generpagehtml({ page : pageno, //总页码 total : totalpage, //总数据条数 totalrecords : totalrecords, //链接前部 hrefformer : url, //链接尾部 hreflatter : '', getlink : function(n){ if(param==undefined||param==null){ return this.hrefformer + this.hreflatter + "?page="+n; }else{ return this.hrefformer + this.hreflatter + "?page="+n+param; } }, lang : { firstpagetext : '首页', lastpagetext : '尾页', prepagetext : '上一页', nextpagetext : '下一页', totalpagebeforetext : '共', totalpageaftertext : '页', totalrecordsaftertext : '条', gopagebeforetext : '转到', gopagebuttonoktext : '确定', gopageaftertext : '页', buttontipbeforetext : '第', buttontipaftertext : '页' } //, //mode : 'click',//默认值是link,可选link或者click //click : function(n){ // this.selectpage(n); // return false; //} }); } function focus_gopage(){ kkpager.focus_gopage(); }