分享一下自己在项目中引用的Jquery分页控件
index.html内容
"zh-cn" xmlns="http://www.w3.org/1999/xhtml">
"utf-8" />
jquery.page.js中的内容
(function($){var ms = {init:function(obj,args){return (function(){ms.fillHtml(obj,args);ms.bindEvent(obj,args);})();},//填充html
fillHtml:function(obj,args){return (function(){obj.empty();//上一页if(args.current > 1){obj.append(&#39;上一页&#39;);}else{obj.remove(&#39;.prevPage&#39;);obj.append(&#39;上一页&#39;);}//中间页码if(args.current !&#61; 1 && args.current >&#61; 4 && args.pageCount !&#61; 4){obj.append(&#39;&#39;&#43;1&#43;&#39;&#39;);}if(args.current-2 > 2 && args.current <&#61; args.pageCount && args.pageCount > 5){obj.append(&#39;...&#39;);}var start &#61; args.current -2,end &#61; args.current&#43;2;if((start > 1 && args.current <4)||args.current &#61;&#61; 1){end&#43;&#43;;}if(args.current > args.pageCount-4 && args.current >&#61; args.pageCount){start--;}for (;start <&#61; end; start&#43;&#43;) {if(start <&#61; args.pageCount && start >&#61; 1){if(start !&#61; args.current){obj.append(&#39;&#39;&#43; start &#43;&#39;&#39;);}else{obj.append(&#39;&#39;&#43; start &#43;&#39;&#39;);}}}if(args.current &#43; 2
bindEvent:function(obj,args){return (function(){obj.on("click","a.tcdNumber",function(){var current &#61; parseInt($(this).text());ms.fillHtml(obj,{"current":current,"pageCount":args.pageCount});if(typeof(args.backFn)&#61;&#61;"function"){args.backFn(current);}});//上一页obj.on("click","a.prevPage",function(){var current &#61; parseInt(obj.children("span.current").text());ms.fillHtml(obj,{"current":current-1,"pageCount":args.pageCount});if(typeof(args.backFn)&#61;&#61;"function"){args.backFn(current-1);}});//下一页obj.on("click","a.nextPage",function(){var current &#61; parseInt(obj.children("span.current").text());ms.fillHtml(obj,{"current":current&#43;1,"pageCount":args.pageCount});if(typeof(args.backFn)&#61;&#61;"function"){args.backFn(current&#43;1);}});})();}}$.fn.createPage &#61; function(options){var args &#61; $.extend({pageCount : 15,current : 3,backFn : function(){}},options);ms.init(this,args);}
})(jQuery);
项目中
function AD(s){var postData &#61; {TypeId:&#64;ViewBag.keyValue,page:s };postData &#61; JSON.stringify(postData);var data&#61;{queryJson:postData};$.SetForm({url: "../../publicinfomanage/notice/getpagelistjson",param: data,success: function (result) {$("#NLS").html("");var htmls &#61; "";for (var i &#61; 0; i