复制代码 代码如下:
<script src="/UploadFiles/2021-04-02/jquery-1.4.1.js"> <script type="text/javascript">
var pageindex = 1;
var pagesize = 2;
$(function () {
previous();
})
function previous() {
if (pageindex < 1 || pageindex == 1) {
pageindex = 1;
$("#imgdiv img:lt(" + pagesize + ")").show();
$("#imgdiv img").not($("#imgdiv img:lt(" + pagesize + ")")).hide();
}
else {
pageindex--;
if (pageindex != 1) {
$("#imgdiv img:gt(" + ((pageindex - 1) * pagesize - 1) + "):lt(" + pagesize + ")").show();
$("#imgdiv img").not($("#imgdiv img:gt(" + ((pageindex - 1) * pagesize - 1) + "):lt(" + pagesize + ")")).hide();
}
if (pageindex == 1) {
$("#imgdiv img:lt(" + pagesize + ")").show();
$("#imgdiv img").not($("#imgdiv img:lt(" + pagesize + ")")).hide();
}
}
}
function next() {
var p = $("#imgdiv img").length / pagesize;
var pagecount = parseInt(Math.ceil(p));
if (pageindex + 1 > pagecount) {
pageindex = pagecount;
} else {
pageindex++;
}
$("#imgdiv img:gt(" + ((pageindex - 1) * pagesize - 1) + "):lt(" + pagesize + ")").show();
$("#imgdiv img").not($("#imgdiv img:gt(" + ((pageindex - 1) * pagesize - 1) + "):lt(" + pagesize + ")")).hide();
}
</script>
<div>
<a href="javascript:previous()">上一页</a>
<div id="imgdiv">
<img src="/UploadFiles/2021-04-02/001.jpg"> <img src="/images/002.jpg"> <img src="/UploadFiles/2021-04-02/003.jpg"> <img src="/images/004.jpg"> <img src="/UploadFiles/2021-04-02/005.jpg"> </div>
<a href="javascript:next()">下一页</a>
</div>
<script src="/UploadFiles/2021-04-02/jquery-1.4.1.js"> <script type="text/javascript">
var pageindex = 1;
var pagesize = 2;
$(function () {
previous();
})
function previous() {
if (pageindex < 1 || pageindex == 1) {
pageindex = 1;
$("#imgdiv img:lt(" + pagesize + ")").show();
$("#imgdiv img").not($("#imgdiv img:lt(" + pagesize + ")")).hide();
}
else {
pageindex--;
if (pageindex != 1) {
$("#imgdiv img:gt(" + ((pageindex - 1) * pagesize - 1) + "):lt(" + pagesize + ")").show();
$("#imgdiv img").not($("#imgdiv img:gt(" + ((pageindex - 1) * pagesize - 1) + "):lt(" + pagesize + ")")).hide();
}
if (pageindex == 1) {
$("#imgdiv img:lt(" + pagesize + ")").show();
$("#imgdiv img").not($("#imgdiv img:lt(" + pagesize + ")")).hide();
}
}
}
function next() {
var p = $("#imgdiv img").length / pagesize;
var pagecount = parseInt(Math.ceil(p));
if (pageindex + 1 > pagecount) {
pageindex = pagecount;
} else {
pageindex++;
}
$("#imgdiv img:gt(" + ((pageindex - 1) * pagesize - 1) + "):lt(" + pagesize + ")").show();
$("#imgdiv img").not($("#imgdiv img:gt(" + ((pageindex - 1) * pagesize - 1) + "):lt(" + pagesize + ")")).hide();
}
</script>
<div>
<a href="javascript:previous()">上一页</a>
<div id="imgdiv">
<img src="/UploadFiles/2021-04-02/001.jpg"> <img src="/images/002.jpg"> <img src="/UploadFiles/2021-04-02/003.jpg"> <img src="/images/004.jpg"> <img src="/UploadFiles/2021-04-02/005.jpg"> </div>
<a href="javascript:next()">下一页</a>
</div>
标签:
jQuery,客户端,分页
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“jQuery客户端分页实例代码”评论...