多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內最全IT社區平臺 聯系我們 | 收藏本站
阿里云優惠2
您當前位置:首頁 > 互聯網 > Jquery異步分頁控件

Jquery異步分頁控件

來源:程序員人生   發布時間:2015-09-02 07:56:26 閱讀次數:7089次

ascx控件:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Pager.ascx.cs" Inherits="com.eshop.www.Web.controls.Pager" %> <script src="/script/pagination/Pager.js" type="text/javascript"></script> <div class="paginator-wrap"> <div class="paginator"> <ul class="ul-wrap"> <li id="first" class="btn btn-m"> <a style="cursor:pointer;"> 首頁 </a> </li> <li id="pre" class="btn btn-m"> <a style="cursor:pointer;"> 上1頁 </a> </li> <li class="btn btn-m"> <a id="next" style="cursor:pointer;"> 下1頁 </a> </li> <li class="btn btn-m"> <a id="end" style="cursor:pointer;"> 尾頁 </a> </li> 頁次:<em id="cp">1</em>/<em id="ye">0</em>頁 共<em id="mc">0</em>條記錄 <%--<li class="goto">到第</span><input type="text"><span class="words">頁</span></li>--%> <li class="submit"> <input type="submit" value="肯定"></li> </ul> </div> </div>

Jquery插件:

jQuery.fn.pager = function (recordCount, opts) { opts = jQuery.extend({ pageSize: 10, num_display_entries: 10, current_page: 1, num_edge_entries: 0, link_to: "#", prev_text: "Prev", next_text: "Next", ellipse_text: "...", prev_show_always: true, next_show_always: true, callback: function () { return false; } }, opts || {}); var pageNum = 0; function numPages() { return Math.ceil(recordCount / opts.pageSize); } //對象初始化 function Init() { pageNum = numPages(); //當前頁數 $("#cp").text(opts.current_page); //總頁數 $("#ye").text(pageNum); //數據總條數 $("#mc").text(recordCount); //前1頁 $("#pre").click(function () { PrevPage(); }) //下1頁 $("#next").click(function () { NextPage(); }) //首頁 $("#first").click(function () { FirstPage(); }) //尾頁 $("#end").click(function () { EndPage(); }) //顯示第1頁 opts.callback(0, opts.pageSize); } //首頁 function FirstPage() { if (opts.current_page > 1) { opts.current_page = 1; $("#cp").text(opts.current_page); //調用數據綁定方法 opts.callback(opts.current_page - 1, opts.pageSize); } } //下1頁 function NextPage() { if (opts.current_page != pageNum) { opts.current_page += 1; $("#cp").text(opts.current_page); //調用數據綁定方法 opts.callback(opts.current_page - 1, opts.pageSize); } } //前1頁 function PrevPage() { var currentpage = parseInt($("#PageIndex").val()); if (opts.current_page > 1) { opts.current_page -= 1; $("#cp").text(opts.current_page - 1); //調用數據綁定方法 opts.callback(opts.current_page - 1, opts.pageSize); } } //尾頁 function EndPage() { if (opts.current_page != pageNum) { opts.current_page = pageNum; $("#cp").text(opts.current_page); //調用數據綁定方法 opts.callback(opts.current_page - 1, opts.pageSize); } } Init(); }

頁面調用示例:

<script> $(function () { //第1個參數 數據總條數 $(".paginator").pager(<%=RecordCount %>, { pageSize: 5, current_page: 1, prev_text: "Prev", next_text: "Next", callback: QueryCommentInfo }); }) function QueryCommentInfo(pageIndex, pageSize) { $("#CommentInfo").html("<tr style=" margin-top:200px;"><td colspan="4"><img src="http://<%=com.eshop.www.Tools.StringHelper.SreverUrl %>/ds_shangcheng_pc/images/load.gif" /></div>正在加載,請稍后。。。</td></tr>"); $.post("/ajaxTodo/MemberComment.aspx", { Func: "QueryCommentInfo", pageIndex: pageIndex, pageSize: pageSize }, function (data) { if (data.toString() != "") { var jsonStr = data.toString().split("]")[0] + "]"; var dataStr = data.toString().split("]")[1]; var ary = $.parseJSON(jsonStr); var conStr = ""; $(ary).each(function () { var tr = "<tr><td class="star"><div class="icon-" + (",0,1,".indexOf("," + this.score + ",") >= 0 ? "badstar" : "goodstar") + ""></div></td><td class="comment"><div class="item">" + this.content + "</div></td><td class="date"><p class="date">" + this.create_date.split(" ")[0] + "</p><p class="time">" + this.create_date.split(" ")[1] + "</p></td><td class="info"> <a href="/retail/ProductShow.aspx?productcode=" + this.product_code + "">" + this.product_name + "</a> <p class="price"><span class="count">" + this.product_price + "</span>元</p></td></tr>"; conStr += tr; }) $("#CommentInfo").html(conStr); } }) } </script>

注意:要援用Jquery類庫

生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關閉
程序員人生
主站蜘蛛池模板: v天堂在线 | 狂野欧美激情性xxxx | 在线视频 一区二区 | 欧美极品xxx | 欧美在线精品永久免费播放 | 国产免费不卡v片在线观看 国产免费叼嘿视频 | 免费在线观看成年人视频 | 亚洲免费在线观看视频 | 456免费视频 | 亚洲另类春色 | japanxxxx日本黑人 | 亚洲欧洲日韩国产 | 福利一区三区 | 男人边吃奶边摸下面好爽视频 | 最近中文字幕高清字幕 | 99综合网 | 国内精品久久久久久影院8f | 国产毛片不卡 | 亚洲国产精品免费 | 亚洲伊人久久大香线蕉综合图片 | 曰本裸色私人影院噜噜噜影院 | 欧美性天堂 | 精品三级内地国产在线观看 | 亚洲毛片免费视频 | 亚洲综合无码一区二区 | 精品国产一区二区三区四 | 亚洲国产一区二区三区在线观看 | 欧美一区二区三区精品 | 久久精品国产第一区二区 | 亚洲高清在线看 | xxxxx性欧美hd另类 | 中文字幕乱码视频32 | 在线观看亚洲人成网站 | 亚洲天堂一区二区三区 | free asian xxxxx黑人 | 亚洲最大成人在线 | 欧美精品在线播放 | 欧美另类性视频在线看 | 久久精品一品道久久精品9 久久精品一区二区 | 天天爱综合 | 宇都宫紫苑乳在线观看 |