久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      • <bdo id='ABrDX'></bdo><ul id='ABrDX'></ul>
      1. <small id='ABrDX'></small><noframes id='ABrDX'>

        <tfoot id='ABrDX'></tfoot>
      2. <legend id='ABrDX'><style id='ABrDX'><dir id='ABrDX'><q id='ABrDX'></q></dir></style></legend>

        <i id='ABrDX'><tr id='ABrDX'><dt id='ABrDX'><q id='ABrDX'><span id='ABrDX'><b id='ABrDX'><form id='ABrDX'><ins id='ABrDX'></ins><ul id='ABrDX'></ul><sub id='ABrDX'></sub></form><legend id='ABrDX'></legend><bdo id='ABrDX'><pre id='ABrDX'><center id='ABrDX'></center></pre></bdo></b><th id='ABrDX'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ABrDX'><tfoot id='ABrDX'></tfoot><dl id='ABrDX'><fieldset id='ABrDX'></fieldset></dl></div>
      3. Jquery 循環無法正常工作?

        Jquery Loop not working correctly?(Jquery 循環無法正常工作?)

        • <legend id='iz87z'><style id='iz87z'><dir id='iz87z'><q id='iz87z'></q></dir></style></legend>

                <bdo id='iz87z'></bdo><ul id='iz87z'></ul>
                <i id='iz87z'><tr id='iz87z'><dt id='iz87z'><q id='iz87z'><span id='iz87z'><b id='iz87z'><form id='iz87z'><ins id='iz87z'></ins><ul id='iz87z'></ul><sub id='iz87z'></sub></form><legend id='iz87z'></legend><bdo id='iz87z'><pre id='iz87z'><center id='iz87z'></center></pre></bdo></b><th id='iz87z'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='iz87z'><tfoot id='iz87z'></tfoot><dl id='iz87z'><fieldset id='iz87z'></fieldset></dl></div>
              • <tfoot id='iz87z'></tfoot>

                    <tbody id='iz87z'></tbody>

                  <small id='iz87z'></small><noframes id='iz87z'>

                1. 本文介紹了Jquery 循環無法正常工作?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在嘗試創建一個循環來創建許多函數,以便當用戶單擊拇指向上按鈕時,它會運行正確的 .php 文檔.當我刪除循環并只給 var i 一個特定的數字時,它工作得很好,但是一旦我嘗試將它變成一個循環,在 alert(i) 我在第一個循環中得到 10.

                  I am trying to create a loop to create many functions so that when a user clicks the thumb up button it runs the correct .php document. It works great when I remove the loop and just give var i a specific number but as soon as i try to make it into a loop, at the alert(i) i get 10 on the first loop.

                   var i=1;
                   while ( ++i < 10 ) {
                      $('#thumbup' + i).click(function() {
                          var userid = $('#theuser' + i).text();
                          var url = "_thumbup.php?userid=" + userid;
                          //alert(url);
                  
                          $('#thumbup' + i).hide();
                          $('#thumbdown' + i).hide();
                  
                          $("#toggle").css("display","block");
                          alert(i); // Give me 10 on first loop?!?
                  
                          // get the URL
                          http = new XMLHttpRequest(); 
                          http.open("GET", url, true);
                          http.send(null);
                  
                          // prevent form from submitting
                          return false;   
                  
                      }); 
                    }
                  

                  推薦答案

                  這是一個經典問題:當你的回調被調用時,i 的值是 end of loop.

                  This is a classical problem : by the time your callbacks are called, i has the value of end of loop.

                  解決方法如下:

                  var i=1;
                  while ( ++i < 10 ) {
                     (function(i){
                        // your current code
                     })(i);
                  }
                  

                  之所以有效,是因為內部函數在調用時創建了一個作用域,而這個作用域包含了你想要的i的值.

                  It works because the internal function creates a scope when it is called, and this scope contains the value of i you want.

                  這篇關于Jquery 循環無法正常工作?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                  Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                  PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                  mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                  Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                  MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)

                    <bdo id='JIhBJ'></bdo><ul id='JIhBJ'></ul>
                      <legend id='JIhBJ'><style id='JIhBJ'><dir id='JIhBJ'><q id='JIhBJ'></q></dir></style></legend>
                          <tbody id='JIhBJ'></tbody>

                        <i id='JIhBJ'><tr id='JIhBJ'><dt id='JIhBJ'><q id='JIhBJ'><span id='JIhBJ'><b id='JIhBJ'><form id='JIhBJ'><ins id='JIhBJ'></ins><ul id='JIhBJ'></ul><sub id='JIhBJ'></sub></form><legend id='JIhBJ'></legend><bdo id='JIhBJ'><pre id='JIhBJ'><center id='JIhBJ'></center></pre></bdo></b><th id='JIhBJ'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='JIhBJ'><tfoot id='JIhBJ'></tfoot><dl id='JIhBJ'><fieldset id='JIhBJ'></fieldset></dl></div>

                      • <small id='JIhBJ'></small><noframes id='JIhBJ'>

                        1. <tfoot id='JIhBJ'></tfoot>
                          • 主站蜘蛛池模板: 在线观看久草 | 久久国产精品91 | 国产91视频免费 | 精品在线 | 午夜影晥| 久久99精品视频 | 免费观看国产视频在线 | 欧美成人精品激情在线观看 | 久久美女网 | 成人亚洲 | 四虎影院一区二区 | 亚洲美女av网站 | 久操福利| 国产精品视频一二三区 | 一级黄色毛片免费 | 成人在线视频观看 | 久一精品 | 91免费在线视频 | 亚洲精品久久久久avwww潮水 | 午夜私人影院在线观看 | 欧美日本久久 | 九色在线观看 | 亚洲日韩第一页 | 午夜影视 | 国产精品片aa在线观看 | 在线观看你懂的网站 | 牛牛热在线视频 | 中文字幕一区二区三区精彩视频 | 欧美一区二区三区在线视频 | 成人久久18免费网站图片 | 欧美激情精品久久久久久 | 一区二区日韩 | 青春草在线 | 日韩精品成人一区二区三区视频 | 在线精品亚洲欧美日韩国产 | 亚洲精品一区二区三区中文字幕 | 欧美在线不卡 | 亚洲国产免费 | 成人在线一级片 | 在线观看亚洲 | 精品久久影院 |