AJAX Event Handlers, like shift key pressing


#1

Hey everyone,

I thought I’d seen a demo of an AJAX app that responded to control
key presses, like performing a different action when the shift key is
pressed. What I’d really like to do is have a div change when the
shift key is pressed (to change the text of the link inside it to
indicate what new action will occur when that link is clicked with
shift held down). Is there a rails way of doing this?

-Josh


#2

On 08 Feb 2006, at 20:06, Joshua Gitlin wrote:

Hey everyone,

I thought I’d seen a demo of an AJAX app that responded to control
key presses, like performing a different action when the shift key
is pressed. What I’d really like to do is have a div change when
the shift key is pressed (to change the text of the link inside it
to indicate what new action will occur when that link is clicked
with shift held down). Is there a rails way of doing this?

I don’t believe you can detect a modifier being pressed using
JavaScript (as this is a client-side detection), unless combined with
a conventional keydown.

Check http://www.cross-browser.com/x/examples/shift_mode.php for an
example.

Best regards

Peter De Berdt