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

    <legend id='h7ERx'><style id='h7ERx'><dir id='h7ERx'><q id='h7ERx'></q></dir></style></legend>

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

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

    1. <tfoot id='h7ERx'></tfoot>

      為什么在 keydown 回調中返回 false 不會停止按鈕單

      Why does returning false in the keydown callback does not stop the button click event?(為什么在 keydown 回調中返回 false 不會停止按鈕單擊事件?)

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

          <legend id='iEr6S'><style id='iEr6S'><dir id='iEr6S'><q id='iEr6S'></q></dir></style></legend>

                <tbody id='iEr6S'></tbody>
              <tfoot id='iEr6S'></tfoot>

              <i id='iEr6S'><tr id='iEr6S'><dt id='iEr6S'><q id='iEr6S'><span id='iEr6S'><b id='iEr6S'><form id='iEr6S'><ins id='iEr6S'></ins><ul id='iEr6S'></ul><sub id='iEr6S'></sub></form><legend id='iEr6S'></legend><bdo id='iEr6S'><pre id='iEr6S'><center id='iEr6S'></center></pre></bdo></b><th id='iEr6S'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='iEr6S'><tfoot id='iEr6S'></tfoot><dl id='iEr6S'><fieldset id='iEr6S'></fieldset></dl></div>
                <bdo id='iEr6S'></bdo><ul id='iEr6S'></ul>
              • 本文介紹了為什么在 keydown 回調中返回 false 不會停止按鈕單擊事件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我有一個按鈕和以下 javascript 例程.

                I have a button and the following javascript routine.

                $("button").keydown( function(key) {
                  switch(key.keyCode) {
                  case 32: //space
                    return false;
                  }
                } );
                

                據我了解,return false; 會阻止按鍵被處理.所以 $("button").click(); 不會被調用.對于其他鍵碼,這按預期工作.例如,如果我截取40,即向下按鈕,則頁面不滾動.

                as I understood it, the return false; would stop the keypress from being processed. So $("button").click(); would not be called. For other keyCodes, this works as expected. For example, if I intercept40, which is the down button, the page is not scrolling.

                我在 Firefox 中注意到了這種行為.

                I noticed this behavior in Firefox.

                為什么 return false; 不會停止空間上的按鈕單擊事件?javascript 規范對此有何評論?

                Why does the return false; does not stop the button click event on space? What does the javascript spec say about this?

                推薦答案

                希望這能回答你的問題:

                Hope this answers your question:

                <input type="button" value="Press" onkeydown="doOtherStuff(); return false;">
                

                return false; 如果在 HTML 中的事件處理程序屬性的末尾調用,則成功取消跨瀏覽器的事件.據我所知,這種行為在任何地方都沒有正式規定.

                return false; successfully cancels an event across browsers if called at the end of an event handler attribute in the HTML. This behaviour is not formally specified anywhere as far as I know.

                如果您改為通過 DOM 元素上的事件處理程序屬性設置事件(例如 button.onkeydown = function(evt) {...})或使用 addEventListener/attachEvent(例如 button.addEventListener("keydown", function(evt) {...}, false))然后只返回 false 來自該函數的功能并非在每個瀏覽器中都有效,您需要從我的其他答案中執行 returnValuepreventDefault() 內容.preventDefault 在 DOM 2 規范 并由大多數主流現代瀏覽器實現.returnValue 是特定于 IE 的.

                If you instead set an event via an event handler property on the DOM element (e.g. button.onkeydown = function(evt) {...}) or using addEventListener/attachEvent (e.g. button.addEventListener("keydown", function(evt) {...}, false)) then just returning false from that function does not work in every browser and you need to do the returnValue and preventDefault() stuff from my other answer. preventDefault is specified in the DOM 2 spec and is implemented by most mainstream modern browsers. returnValue is IE-specific.

                這篇關于為什么在 keydown 回調中返回 false 不會停止按鈕單擊事件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)

                  <tbody id='4pX9u'></tbody>

                  <bdo id='4pX9u'></bdo><ul id='4pX9u'></ul>

                    <small id='4pX9u'></small><noframes id='4pX9u'>

                    <tfoot id='4pX9u'></tfoot>
                      1. <legend id='4pX9u'><style id='4pX9u'><dir id='4pX9u'><q id='4pX9u'></q></dir></style></legend>
                        • <i id='4pX9u'><tr id='4pX9u'><dt id='4pX9u'><q id='4pX9u'><span id='4pX9u'><b id='4pX9u'><form id='4pX9u'><ins id='4pX9u'></ins><ul id='4pX9u'></ul><sub id='4pX9u'></sub></form><legend id='4pX9u'></legend><bdo id='4pX9u'><pre id='4pX9u'><center id='4pX9u'></center></pre></bdo></b><th id='4pX9u'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='4pX9u'><tfoot id='4pX9u'></tfoot><dl id='4pX9u'><fieldset id='4pX9u'></fieldset></dl></div>
                          主站蜘蛛池模板: 精品视频一区在线 | 久久久久久久一区二区三区 | 欧美一区二区三区视频在线观看 | 免费中文字幕 | 欧美一区二区三区一在线观看 | 久久久国产精品 | 91传媒在线播放 | 在线一区 | 97操操| 黄色视频a级毛片 | 伊人色综合久久久天天蜜桃 | 国产精品视屏 | 日日天天| 一级毛片免费完整视频 | 一区精品国产欧美在线 | 久久精品手机视频 | 亚洲成人一区二区三区 | 91视频国产区 | 国产精品久久久久久 | 国产aⅴ精品 | 久久精品一区 | 色视频在线观看 | 夜夜爽99久久国产综合精品女不卡 | 成人免费小视频 | 亚洲精品免费视频 | 成人久久 | 天天操天天摸天天爽 | 91在线精品一区二区 | 中文字幕不卡在线88 | 亚洲欧美一区二区在线观看 | 999免费网站 | 日韩精品免费在线观看 | 日日久| 中文在线播放 | 一级国产精品一级国产精品片 | 久久免费精品视频 | 久久精品国产亚洲一区二区三区 | 亚洲精品无 | 亚洲视频在线一区 | 免费不卡视频 | 三级黄视频在线观看 |