欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

基于jquery的分页控件(C#)_jquery

程序员文章站 2022-06-08 12:50:21
...
JS代码:
Code:
复制代码 代码如下:

var _MaxPageSize = 0;
var _PageSize = 5;
var _IsUpDown = false;
function InitPage(funName, currentPageSize, maxPageSize, pageSize, isUpDown) {
_FunName = funName;
_CurrentPageSize = currentPageSize;
_MaxPageSize = maxPageSize;
_PageSize = pageSize;
_IsUpDown = isUpDown;
}
function ShowPage(objDiv) {
var strResult = "";
var size = Math.floor(_PageSize / 2);
var maxSize = _CurrentPageSize + size > _MaxPageSize ? _MaxPageSize : _CurrentPageSize + size;
var minSize = _CurrentPageSize - size if (maxSize == _MaxPageSize)
minSize = maxSize - _PageSize + 1;
if (minSize == 1)
maxSize = minSize + _PageSize - 1;
var str = "";
for (var i = 0; i var curPage = i + 1;
if (curPage == 1 || (curPage >= minSize && curPage var strPage = "";
if (curPage == minSize && (_CurrentPageSize > _PageSize || minSize > 2))
strPage += "... ";
if (_CurrentPageSize == curPage) {
strPage += " " + curPage + "";
}
else {
strPage += " " + curPage + "";
}
if (curPage == maxSize && _MaxPageSize - _CurrentPageSize - 1 > size) {
strPage += "... ";
}
strResult += strPage;
}
}
strResult += "";
if (_IsUpDown) {
if (_CurrentPageSize == 1)
strResult = "上一页" + strResult;
else
strResult = " 上一页" + strResult;
if (_CurrentPageSize == _MaxPageSize) {
strResult = strResult + " 下一页";
}
else {
strResult = strResult + " 下一页";
}
}
document.getElementById(objDiv).innerHTML =strResult;
}

HTML Code:
复制代码 代码如下:







基于jquery的分页控件(C#)_jquery
















  • 基于jquery的分页控件(C#)_jquery


    对 【
    】说:




















相关标签: jquery 分页控件