Like if they press A regardless of the caps for it to pull up Apps, Pressing D pulls up Dashboard. This should only work if their mouse is not in a area where they can type. How would i do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is the pseudo code I would follow:
Basically, you have an event listener waiting for your particular key(s) to be pressed. You only execute the coolFunc(), however, if they have focus on your webpage (i.e. not the address bar) and they are not inside a input element.
I would also recommend using jQuery; it will make your code a lot cleaner and easier to write.
Let me know if you need an actual JS example, not pseudo-code.