J
jbigham
Hello,
I'd like to capture key events using javascript, but don't want to
process such events when the user is typing into an input box or into a
textarea. As an example, gmail has a feature where you can type "r"
anywhere on the page while viewing a message and it will open a reply
box, but if you type an "r" while entering text into a form, it doesn't
do this.
My question is how to do this most efficiently.
Should I capture all events of interest and then determine whether to
act based on the object that has focus?
Should I define many onkeypress events for each of the objects on the
page that aren't text boxes?
Should I define the onkeypress at page level but return null for
onkeypress from each of the text boxes on the page?
What do you think?
Thanks!
Jeff
I'd like to capture key events using javascript, but don't want to
process such events when the user is typing into an input box or into a
textarea. As an example, gmail has a feature where you can type "r"
anywhere on the page while viewing a message and it will open a reply
box, but if you type an "r" while entering text into a form, it doesn't
do this.
My question is how to do this most efficiently.
Should I capture all events of interest and then determine whether to
act based on the object that has focus?
Should I define many onkeypress events for each of the objects on the
page that aren't text boxes?
Should I define the onkeypress at page level but return null for
onkeypress from each of the text boxes on the page?
What do you think?
Thanks!
Jeff