asp.net学习_分页的设计(4)
来源:未知 责任编辑:责任编辑 发表时间:2014-04-20 03:40 点击:次
2: //每次只显示5个页码
3: //修改:2012/4/26
4: //tianzhuanghu
5: //http://www.cnblogs.com/mysweet/ 我的博客
6: (function($) {
7: //设定页码方法,初始化
8: $.fn.setPager = function(options) {
9: var opts = $.extend({}, pagerDefaults, options);
10: return this.each(function() {
11: //修改,能够动态设置PageSize
12: pagerDefaults.PageSize=options.PageSize;
13: $(this).empty().append(setPagerHtml(parseInt(options.RecordCount), parseInt(options.PageIndex), options.buttonClick));
14: $('.pager a').mouseover(function() { document.body.style.cursor = "pointer"; }).mouseout(function() { document.body.style.cursor = "auto"; });
15: });
16: };
17: //设定页数及html
18: function setPagerHtml(RecordCount, PageIndex, pagerClick) {
19:
20: var $content = $("<div class=\"pager\"></div>");
21: var startPageIndex = 1;
22: //若页码超出
23: if (RecordCount <= 0) RecordCount = pagerDefaults.PageSize;
24: var PageSize=pagerDefaults.PageSize;
25: //alert(pagerDefaults.PageSize);
26: //末页
27: var endPageIndex = parseInt(RecordCount % parseInt(PageSize)) > 0 ? parseInt(RecordCount / parseInt(PageSize)) + 1 : RecordCount / parseInt(PageSize);
28:
29: if (PageIndex > endPageIndex) PageIndex = endPageIndex;
30: if (PageIndex <= 0) PageIndex = startPageIndex;
31: var nextPageIndex = PageIndex + 1;
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>