Observe document, rather than document.body:

Event.observe(document, 'keydown', myEventHandler);

That works with FF3, IE7, and Opera9 (all on Windows).

T.J. Crowder
tj / crowder software / com
Independent Software Engineer, consulting services available

On Mar 10, 2:30 pm, chloraphil <chlorap...@gmail.com> wrote:
> Could someone please help me understand what is going on here?  Note
> that I want the event to fire regardless of where focus is.
> The following works fine on IE6, IE7, and chrome. Not working on ff
> 3.0.7.
> <html><head>
> <script src="prototype.js" type="text/javascript" ></script>
> <script type="text/javascript">
> Event.observe(window, 'load',
>     function(){
>         Event.observe(document.body, 'keydown', myEventHandler);
>     });
> function myEventHandler(evt) {
>     alert(evt.keyCode);}
> </script>
> </head>
> <body >
> <input type="text" /><br><br>
> </body></html>
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to