javascript Club
登録する
Fanpop
New Post
Explore Fanpop
In this post, あなた can test yourself on which key あなた were pressed. When あなた get this event contains all the event information that あなた might need to write your own code.

Sometimes あなた need to prevent some keyboard key operations like prevent to select all text, copy, paste, etc. At that time あなた need to write a JavaScript keyboard event function to handle it as per your need.

link
The following JavaScript code, when a keypress event fires, あなた will get all event properties. For example, when あなた pressing “1”, あなた will get “49” value. It is recommended to write logic on an event.which instead of event.keyCode and event.charCode.