|
Reading the user's keystrokes
How can I read a user's keystrokes in JavaScript? Every example I have seen requires you to create an input area, and then it associates the keystroke events with that area. I don't want anything like that. I want the user to be able to press a key at any time, no matter where the cursor happens to be, and get the desired action. For example, a user might press a question mark "?" and the webpage could display some help text, or maybe the user could type "X" and the page would cancel the previous action.
|