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.