check the event.target. if it's an input, don't alert.

On Thu, Jul 22, 2010 at 9:34 PM, Matt Thomson <[email protected]> wrote:

> Thanks for the code, I can get this to work:
>
> //keydown in text input makes alert
> $('id_of_a_text_input').addEvent('keydown', function(event)
> {alert(1)});
>
>
> But the code below seems to only make all the input fields have the
> above behaviour:
> //all input areas inherit above behavior:
> $(document.body).addEvent('keydown', function(event){alert(1)});
>
> Is there someway to get the key buttons to work when the cursor is not
> in an input field, as the user of the slideshow will just go onto the
> page, and then hit the arrow buttons.
>
>
>
> On Jul 23, 7:19 am, Aaron Newton <[email protected]> wrote:
> > > 'keydown' not 'keyDown'
> >
> > my bad.
>

Reply via email to