99 lines
2.6 KiB
HTML
99 lines
2.6 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<title>兼容IE7以上的分页插件</title>
|
||
<script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
|
||
<script type="text/javascript" src="js/kkpager.js"></script>
|
||
<link rel="stylesheet" type="text/css" href="style/kkpager_orange.css" />
|
||
</head>
|
||
<!--[if !IE ]>
|
||
<style type="text/css">
|
||
#kkpager_btn_go {
|
||
top:-16px !important;
|
||
}
|
||
</style> <![endif]-->
|
||
<!--使用说明 https://github.com/pgkk/kkpager -->
|
||
<body>
|
||
<div style="width:800px;margin:0 auto;">
|
||
<div id="kkpager"></div>
|
||
</div>
|
||
<script type="text/javascript">
|
||
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
|
||
$(function(){
|
||
var totalPage = 5;
|
||
var totalRecords = 90;
|
||
var pageNo = getParameter('pno');
|
||
if(!pageNo){
|
||
pageNo = 1;
|
||
//原本是实现无刷新跳转,我这是根据自己需求做的有刷新时跳转
|
||
// 如:www.baidu.com/abcd/index.jhtml
|
||
/* let str=window.location.pathname;
|
||
let two; // 第二个斜杠后内容
|
||
let first = str.indexOf("/") + 1;
|
||
let heng = str.indexOf("/", first);
|
||
if (heng == -1) {
|
||
} else {
|
||
two = str.substring(heng).substring(1, str.length);
|
||
}
|
||
if(two=="index.jhtml"){
|
||
pageNo = 1;
|
||
}else{
|
||
pageNo = num;//num是根据自己要点击第几页写的
|
||
}*/
|
||
}
|
||
//生成分页
|
||
//有些参数是可选的,比如lang,若不传有默认值
|
||
kkpager.generPageHtml({
|
||
pno : pageNo,
|
||
//总页码
|
||
total : totalPage,
|
||
//总数据条数
|
||
totalRecords : totalRecords,
|
||
mode : 'click',//默认值是link,可选link或者click
|
||
click : function(n){
|
||
this.selectPage(n);
|
||
|
||
if(n==1){
|
||
//原本是实现无刷新跳转,我这是根据自己需求做的有刷新时跳转
|
||
//第一页写逻辑跳转
|
||
// 如:window.location.href=......;
|
||
}else{
|
||
//除了第一页写逻辑跳转
|
||
}
|
||
return false;
|
||
}
|
||
|
||
/* ,lang: {
|
||
firstPageText : '首页',
|
||
firstPageTipText : '首页',
|
||
lastPageText : '尾页',
|
||
lastPageTipText : '尾页',
|
||
prePageText : '上一页',
|
||
prePageTipText : '上一页',
|
||
nextPageText : '下一页',
|
||
nextPageTipText : '下一页',
|
||
totalPageBeforeText : '共',
|
||
totalPageAfterText : '页',
|
||
currPageBeforeText : '当前第',
|
||
currPageAfterText : '页',
|
||
totalInfoSplitStr : '/',
|
||
totalRecordsBeforeText : '共',
|
||
totalRecordsAfterText : '条数据',
|
||
gopageBeforeText : ' 转到',
|
||
gopageButtonOkText : '确定',
|
||
gopageAfterText : '页',
|
||
buttonTipBeforeText : '第',
|
||
buttonTipAfterText : '页'
|
||
}*/
|
||
});
|
||
});
|
||
</script>
|
||
|
||
</body>
|
||
</html> |