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

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

      1. <small id='NlLXW'></small><noframes id='NlLXW'>

        <tfoot id='NlLXW'></tfoot>
        • <bdo id='NlLXW'></bdo><ul id='NlLXW'></ul>
        <legend id='NlLXW'><style id='NlLXW'><dir id='NlLXW'><q id='NlLXW'></q></dir></style></legend>

        keypress 和 keyup - 為什么 keyCode 不同?

        keypress and keyup - why is the keyCode different?(keypress 和 keyup - 為什么 keyCode 不同?)
      2. <i id='wfD99'><tr id='wfD99'><dt id='wfD99'><q id='wfD99'><span id='wfD99'><b id='wfD99'><form id='wfD99'><ins id='wfD99'></ins><ul id='wfD99'></ul><sub id='wfD99'></sub></form><legend id='wfD99'></legend><bdo id='wfD99'><pre id='wfD99'><center id='wfD99'></center></pre></bdo></b><th id='wfD99'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wfD99'><tfoot id='wfD99'></tfoot><dl id='wfD99'><fieldset id='wfD99'></fieldset></dl></div>

          1. <legend id='wfD99'><style id='wfD99'><dir id='wfD99'><q id='wfD99'></q></dir></style></legend><tfoot id='wfD99'></tfoot>
              <bdo id='wfD99'></bdo><ul id='wfD99'></ul>
                <tbody id='wfD99'></tbody>

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

                • 本文介紹了keypress 和 keyup - 為什么 keyCode 不同?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  相關:JavaScript KeyCode vs CharCode

                  這里有一些代碼,您可以在家中或在 jsfiddle 中嘗試:

                  Here is some code you can try at home or in a jsfiddle:

                  el.addEventListener( 'keyup', function( e ) { 
                      console.log( 'Keyup event' );
                      console.log( e.keyCode );
                  } ); 
                  el.addEventListener( 'keypress', function( e ) { 
                      console.log( 'Keypress event' );
                      console.log( e.keyCode );
                  } );
                  

                  為什么keyCode不一樣?

                  Why is the keyCode different?

                  我可以理解為什么一個人應該只使用按鍵,但我不明白的是兩個按鍵事件如何在給定鍵盤上相同的按鍵時給出不同的 keyCode.

                  I can understand why one should use keypress only, but what I don't understand is how two key events, given the same hit key on the keyboard, give different keyCodes.

                  PS:我不擔心舊版瀏覽器的支持,我在 Chrome 中嘗試過,很驚訝,但找不到解釋.

                  PS: I'm not worrying about legacy browsers support, I tried this in Chrome and was surprised, and couldn't find an explanation.

                  推薦答案

                  這些事件的目的完全不同.使用 keyupkeydown 識別物理鍵,使用 keypress 識別鍵入的字符.兩者是具有不同事件的根本不同任務;不要試圖將兩者混為一談.特別是,keypress 事件上的 keyCode 通常是多余的,不應使用(舊版 IE 除外,但請參閱下面的鏈接文檔了解更多信息);對于可打印的按鍵,它通常與 whichcharCode 相同,盡管瀏覽器之間存在一些差異.

                  The events are for completely different purposes. Use keyup and keydown for identifying physical keys and keypress for identifying typed characters. The two are fundamentally different tasks with different events; don't try to mix the two. In particular, keyCode on keypress events is usually redundant and shouldn't be used (except in older IE, but see the linked document below for more on that); for printable keypresses it's usually the same as which and charCode, although there is some variation between browsers.

                  Jan Wolter 關于關鍵事件的文章,已經在另一個答案中鏈接到,是權威詞對我來說這個主題,并有表格描述了每種不同屬性為每種類型的鍵事件和每種瀏覽器返回的內容.

                  Jan Wolter's article on key events, already linked to in another answer, is the definitive word on this subject for me and has tables describing what each of the different properties returns for each type of key event and each browser.

                  這篇關于keypress 和 keyup - 為什么 keyCode 不同?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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='wehpI'></tbody>
                      <bdo id='wehpI'></bdo><ul id='wehpI'></ul>

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

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

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

                            主站蜘蛛池模板: 天天插天天狠天天透 | 国产日韩一区 | 亚洲在线视频 | 美女张开腿露出尿口 | 欧美精品在线看 | 亚洲经典一区 | 国产成人免费 | 国产成人精品一区二区三区网站观看 | 欧美一级观看 | 精品成人一区二区 | 午夜激情视频 | 在线观看欧美日韩视频 | 天天夜天天操 | 日本一区二区三区在线观看 | 99国产在线| 亚洲国产精品视频一区 | 九九热免费观看 | 国产精品久久精品 | 日韩国产精品一区二区三区 | 国产精品视频97 | 国产高清在线观看 | 欧美一区二区另类 | 福利视频网 | 精品影院 | 中文字幕精品视频 | 337p日本欧洲亚洲大胆鲁鲁 | 欧美专区日韩 | 国产成人一区二区三区 | 欧美激情视频一区二区三区在线播放 | 久久久网| 精久久| www.欧美| 国产精品视频久久久 | 国产精品av久久久久久毛片 | 午夜免费视频 | 久久a久久 | 免费黄色av | 在线国产一区二区 | 欧美一区二区在线播放 | 国产精品99久久久久久久久久久久 | 99在线精品视频 |