Is there a way, in Javascript, to capture individual keypresses in
Apple's Safari browser when a text field does not have focus? (Must
work in 1.0, betas are a plus but not required.) In particular, I'd
like to be able to capture the arrow keys.
In IE and Mozilla, this works:
<body onKeyDown="foo(event.keyCode);">
If there's no "clean" way to do it, I may be willing to kludge. One
idea I had was to make a text field, and force it to always have
focus. This lets me capture regular characters (via <input
onKeyDown=...>), but the arrow keys always return a keycode of "0".
(The IE/Mozilla code above returns distinguishable keycodes for the
arrow keys.) |