基于jquery的分页控件(C#)_jquery
程序员文章站
2022-06-03 16:03:06
...
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:
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:
复制代码 代码如下:
推荐阅读
-
ASP.NET MVC+EF在服务端分页使用jqGrid以及jquery Datatables的注意事项
-
jQuery中layer分页器的使用
-
基于jQuery实现一个marquee无缝滚动的插件
-
jquery分页条(基于pagehelper)
-
PHP+jQuery+Ajax实现分页效果 jPaginate插件的应用
-
基于JQuery的购物车添加删除以及结算功能示例
-
jquery dialog open后,服务器端控件失效的快速解决方法
-
jQuery实现判断控件是否显示的方法
-
JS实现点击生成UUID的方法完整实例【基于jQuery】
-
基于Bootstrap和JQuery实现动态打开和关闭tab页的实例代码