Observing the document fixed it. There was no doctype since i created it specifically to demo my issue. I didn't know Prototype "essentially" (?) requires one, good to know.
Thanks for your help! -Philip On Mar 10, 11:25 am, "T.J. Crowder" <[email protected]> wrote: > Hi, > > Also works in Chrome. I noticed you mentioned it specifically, so... > Haven't tried Safari. > > OT, you might also want to use a doctype in your page; Prototype > essentially requires one, and it's good practice. > > -- T.J. :-) > > On Mar 10, 3:24 pm, "T.J. Crowder" <[email protected]> wrote: > > > Hi, > > > Observe document, rather than document.body: > > > Event.observe(document, 'keydown', myEventHandler); > > > That works with FF3, IE7, and Opera9 (all on Windows). > > > HTH, > > -- > > T.J. Crowder > > tj / crowder software / com > > Independent Software Engineer, consulting services available > > > On Mar 10, 2:30 pm, chloraphil <[email protected]> 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
