1. <legend id='rZ0k7'><style id='rZ0k7'><dir id='rZ0k7'><q id='rZ0k7'></q></dir></style></legend>

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

      <tfoot id='rZ0k7'></tfoot>
        <bdo id='rZ0k7'></bdo><ul id='rZ0k7'></ul>

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

        如何切换选择多个复选框,如 GMail?

        时间:2023-11-28
        <i id='nIoJC'><tr id='nIoJC'><dt id='nIoJC'><q id='nIoJC'><span id='nIoJC'><b id='nIoJC'><form id='nIoJC'><ins id='nIoJC'></ins><ul id='nIoJC'></ul><sub id='nIoJC'></sub></form><legend id='nIoJC'></legend><bdo id='nIoJC'><pre id='nIoJC'><center id='nIoJC'></center></pre></bdo></b><th id='nIoJC'></th></span></q></dt></tr></i><div id='nIoJC'><tfoot id='nIoJC'></tfoot><dl id='nIoJC'><fieldset id='nIoJC'></fieldset></dl></div>

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

            <tbody id='nIoJC'></tbody>
          • <bdo id='nIoJC'></bdo><ul id='nIoJC'></ul>

            <legend id='nIoJC'><style id='nIoJC'><dir id='nIoJC'><q id='nIoJC'></q></dir></style></legend>
              <tfoot id='nIoJC'></tfoot>

                  本文介绍了如何切换选择多个复选框,如 GMail?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 GMail 中,用户可以单击电子邮件列表中的一个复选框,按住 Shift 键,然后选择第二个复选框.然后 JavaScript 将选择/取消选择两个复选框之间的复选框.

                  In GMail, the user can click on one checkbox in the email list, hold down the Shift key, and select a second checkbox. The JavaScript will then select/unselect the checkboxes that are between the two checboxes.

                  我很好奇这是怎么做到的?这是 JQuery 还是一些基本(或复杂)的 JavaScript?

                  I am curious as to how this is done? Is this JQuery or some basic (or complex) JavaScript?

                  推荐答案

                  我写了一个使用jquery的独立demo:

                  I wrote a self-contained demo that uses jquery:

                  $(document).ready(function() {
                      var $chkboxes = $('.chkbox');
                      var lastChecked = null;
                  
                      $chkboxes.click(function(e) {
                          if (!lastChecked) {
                              lastChecked = this;
                              return;
                          }
                  
                          if (e.shiftKey) {
                              var start = $chkboxes.index(this);
                              var end = $chkboxes.index(lastChecked);
                  
                              $chkboxes.slice(Math.min(start,end), Math.max(start,end)+ 1).prop('checked', lastChecked.checked);
                          }
                  
                          lastChecked = this;
                      });
                  });

                  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
                  <html>
                  <head>
                  </head>
                  <body>
                      <input type="checkbox" id="id_chk1" class="chkbox" value="1" />Check 1<br/>
                      <input type="checkbox" id="id_chk2" class="chkbox" value="2" />Check 2<br/>
                      <input type="checkbox" id="id_chk3" class="chkbox" value="3" />Check 3<br/>
                      <input type="checkbox" id="id_chk4" class="chkbox" value="4" />Check 4<br/>
                      <input type="checkbox" id="id_chk5" class="chkbox" value="5" />Check 5<br/>
                      <input type="checkbox" id="id_chk6" class="chkbox" value="6" />Check 6<br/>
                      <input type="checkbox" id="id_chk7" class="chkbox" value="7" />Check 7<br/>
                  </body>
                  </html>

                  这篇关于如何切换选择多个复选框,如 GMail?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:为 Gmail 设置 HTML 电子邮件样式 下一篇:使用 HTML 文本预填充 gmail 撰写屏幕

                  相关文章

                  <tfoot id='kiway'></tfoot>

                    <legend id='kiway'><style id='kiway'><dir id='kiway'><q id='kiway'></q></dir></style></legend>
                    1. <small id='kiway'></small><noframes id='kiway'>

                      • <bdo id='kiway'></bdo><ul id='kiway'></ul>
                    2. <i id='kiway'><tr id='kiway'><dt id='kiway'><q id='kiway'><span id='kiway'><b id='kiway'><form id='kiway'><ins id='kiway'></ins><ul id='kiway'></ul><sub id='kiway'></sub></form><legend id='kiway'></legend><bdo id='kiway'><pre id='kiway'><center id='kiway'></center></pre></bdo></b><th id='kiway'></th></span></q></dt></tr></i><div id='kiway'><tfoot id='kiway'></tfoot><dl id='kiway'><fieldset id='kiway'></fieldset></dl></div>