基本信息
源码名称:div分页代码示例
源码大小:0.03M
文件格式:.rar
开发语言:js
更新时间:2018-07-06
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 5 元×
微信扫码支付:5 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
<html>
<head>
<script src="jquery.min.js"></script>
<script>
$(function(){
<!-- 获取要显示的数据的总数量 -->
var pageCount=100;
<!-- 组合完成要显示的字符串 -->
var allPages="";
<!-- 定义每页显示的数量 -->
var listCount=10;
<!-- 页面的数量 -->
var pageNumber=0;
var pageDislay="";
var indexPage=0;
if(pageCount%listCount==0)
{
pageNumber=pageCount/listCount;
}else if(pageCount%listCount!=0)
{
pageNumber=pageCount/listCount 1;
}
<!-- 通过页面填充数 -->
function d(index,count,listCount){
<!-- 显示的开始截至范围 -->
var startCount=0;
var endCount=0;
if(index*listCount>count)
{
endCount=count;
}
else
{
endCount=index*listCount;
}
startCount=listCount*(index-1) 1;
for(var k=startCount;k<=endCount;k )
{
pageDislay ='<table><tr style="border:solid 1px green;"><td style="border:solid 1px green;width:500px;">' k '</td>' '<td style="border:solid 1px green;width:200px;">2323' '</td>' '</tr></table>';
}
$('#page').empty();
$('#page').html(pageDislay);
pageDislay="";
}
indexPage=1;
d(indexPage,pageCount,listCount);
$('#all').html("共" Math.floor(pageNumber) "页");
var aLength=$('a').length;
$('#first').click(function(){
indexPage=1;
d(indexPage,pageCount,listCount);
$('#now').text("当前页为" indexPage);
})
$('#next').click(function(){
indexPage=indexPage 1;
d(indexPage,pageCount,listCount);
$('#now').text("当前页为" indexPage);
})
$('#pre').click(function(){
indexPage=indexPage-1;
d(indexPage,pageCount,listCount);
$('#now').text("当前页为" indexPage);
})
$('#last').click(function(){
indexPage=pageNumber;
d(indexPage,pageCount,listCount);
$('#now').text("当前页为" indexPage);
})
$('#now').text("当前为第" indexPage "页");
});
</script>
</head>
<body>
<div id="page">
</div>
<div id="pagefoot">
<a href="#" id="first">第一页</a>
<a href="#" id="next">下一页</a>
<a href="#" id="now">当前页</a>
<a href="#"id="all"></a>
<a href="#"id="pre">上一页</a>
<a href="#" id="last">最后一页</a>
</div>
</body>
</html>