茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    基于jquery編寫(xiě)分頁(yè)插件
    來(lái)源:易賢網(wǎng) 閱讀:1008 次 日期:2016-07-22 16:08:36
    溫馨提示:易賢網(wǎng)小編為您整理了“基于jquery編寫(xiě)分頁(yè)插件”,方便廣大網(wǎng)友查閱!

    擴(kuò)展JQuery很容易,作為一個(gè)練習(xí),編寫(xiě)一個(gè)簡(jiǎn)單的分頁(yè)插件,代碼量不大,直接看代碼好了:

    $.fn.mypagination = function(totalProperty,opts){ 

      opts = $.extend({ 

        perPage:10, 

        callback:function(){ 

        } 

      },opts||{}); 

      return this.each(function(){ 

        function numPages(){ 

          return Math.ceil(totalProperty/opts.perPage); 

        } 

        function selectPage(page){ 

          return function(){ 

            currPage = page; 

            if (page<0) currPage = 0; 

            if (page>=numPages()) currPage = numPages()-1; 

            render(); 

            $('img.page-wait',panel).attr('src','images/wait.gif'); 

            opts.callback(currPage+1); 

            $('img.page-wait',panel).attr('src','images/nowait.gif'); 

          } 

        } 

        function render(){ 

          var html = '<table><tbody><tr>' 

            +'<td><a href="#"><img class="page-first"></a></td>'

            +'<td><a href="#"><img class="page-prev"></a></td>'

            +'<td><span>第<input type="text" class="page-num">頁(yè)/共'+numPages()+'頁(yè)</span></td>'

            +'<td><a href="#"><img class="page-next"></a></td>'

            +'<td><a href="#"><img class="page-last"></a></td>'

            +'<td><img src="images/nowait.gif" class="page-wait"></td>'

            +'<td><span style="padding-left:50px;">檢索到'+totalProperty+'記錄</span></td>'

            +'</tr></tbody></table>'; 

          var imgFirst = 'images/page-first-disabled.gif'; 

          var imgPrev = 'images/page-prev-disabled.gif'; 

          var imgNext = 'images/page-next-disabled.gif'; 

          var imgLast = 'images/page-last-disabled.gif'; 

          if (currPage > 0){ 

            imgFirst = 'images/page-first.gif'; 

            imgPrev = 'images/page-prev.gif'; 

          } 

          if (currPage < numPages()-1){ 

            imgNext = 'images/page-next.gif'; 

            imgLast = 'images/page-last.gif'; 

          } 

          panel.empty(); 

          panel.append(html); 

          $('img.page-first',panel) 

            .bind('click',selectPage(0)) 

            .attr('src',imgFirst);  

          $('img.page-prev',panel) 

            .bind('click',selectPage(currPage-1)) 

            .attr('src',imgPrev);   

          $('img.page-next',panel) 

            .bind('click',selectPage(currPage+1)) 

            .attr('src',imgNext);   

          $('img.page-last',panel) 

            .bind('click',selectPage(numPages()-1)) 

            .attr('src',imgLast); 

          $('input.page-num',panel) 

            .val(currPage+1) 

            .change(function(){ 

              selectPage($(this).val()-1)(); 

            }); 

        } 

        var currPage = 0; 

        var panel = $(this); 

        render(); 

      }); 

    下面測(cè)試一下:

    <head> 

      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

      <link rel="stylesheet" href="mypagination.css"/> 

      <script type="text/javascript" src="jquery-1.2.6.js"></script> 

      <script type="text/javascript" src="jquery.mypagination.js"></script> 

      <script> 

        $(document).ready(function(){ 

          $('#mypage').mypagination(10112,{ 

            callback:function(page){ 

              alert(page); 

            } 

          }); 

        }); 

      </script> 

    </head> 

    <div id="mypage" class="mypagination"></div> 

    運(yùn)行效果圖如下:

    名單

    以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助。

    更多信息請(qǐng)查看網(wǎng)絡(luò)編程
    易賢網(wǎng)手機(jī)網(wǎng)站地址:基于jquery編寫(xiě)分頁(yè)插件
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢(xún)回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門(mén)公布的正式信息和咨詢(xún)?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報(bào)班

    • 報(bào)班類(lèi)型
    • 姓名
    • 手機(jī)號(hào)
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡(jiǎn)要咨詢(xún) | 簡(jiǎn)要咨詢(xún)須知 | 新媒體/短視頻平臺(tái) | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號(hào):滇ICP備2023014141號(hào)-1 云南省教育廳備案號(hào):云教ICP備0901021 滇公網(wǎng)安備53010202001879號(hào) 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號(hào)
    云南網(wǎng)警備案專(zhuān)用圖標(biāo)
    聯(lián)系電話(huà):0871-65099533/13759567129 獲取招聘考試信息及咨詢(xún)關(guān)注公眾號(hào):hfpxwx
    咨詢(xún)QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專(zhuān)用圖標(biāo)