久久久久久久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 不同?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  相關(guān):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?

                  我可以理解為什么一個人應(yīng)該只使用按鍵,但我不明白的是兩個按鍵事件如何在給定鍵盤上相同的按鍵時給出不同的 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 識別鍵入的字符.兩者是具有不同事件的根本不同任務(wù);不要試圖將兩者混為一談.特別是,keypress 事件上的 keyCode 通常是多余的,不應(yīng)使用(舊版 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 關(guān)于關(guān)鍵事件的文章,已經(jīng)在另一個答案中鏈接到,是權(quán)威詞對我來說這個主題,并有表格描述了每種不同屬性為每種類型的鍵事件和每種瀏覽器返回的內(nèi)容.

                  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.

                  這篇關(guān)于keypress 和 keyup - 為什么 keyCode 不同?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  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 - 使用異步數(shù)據(jù)更新 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 中,如何創(chuàng)建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態(tài)元素 - 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>

                            主站蜘蛛池模板: 九色国产| 国产精品久久国产精品 | 欧美亚洲第一区 | 日韩欧美在线视频 | 久久亚洲美女 | 久久精品国产亚洲一区二区三区 | 日韩电影在线 | 日日av| 亚洲综合热 | 欧洲一级视频 | 久久综合99 | 老司机免费视频 | 久久久久久亚洲欧洲 | 亚洲国产精品99久久久久久久久 | 三级在线观看 | 久夜精品| 亚洲精品一区二区三区中文字幕 | 免费的日批视频 | 国产精品免费av | 日韩精品一区中文字幕 | 亚洲视频区 | 日本爱爱 | 激情一区二区三区 | 女人夜夜春 | 日韩精品免费一区二区在线观看 | 免费观看成人性生生活片 | 国产第一区二区 | av免费看片| 中国美女av | 国产精品久久久久久238 | 久久久久久亚洲精品 | 亚洲日本乱码在线观看 | 91精品国产欧美一区二区成人 | 国产日韩精品一区 | 在线观看亚洲专区 | 国产成人高清 | 黄色片在线观看网址 | 国产超碰人人爽人人做人人爱 | 色综合久久久 | 天堂影院av | 精品91视频 |