> > unfortunately I'm limited to Prototype

Hehe, sorry about that, that didn't come out quite how I meant it!

That solution was exactly what I was looking for. Thanks for your
help, I take back all criticism of Prototype :)

On 9 Jun, 10:10, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
> > unfortunately I'm limited to Prototype
>
> Gosh, you *are* a sweet-talker. ;-)
>
> Google "javascript control key".  Just about all modern browsers
> support the "ctrlKey", "shiftKey", and "altKey" properties on the
> click event, and just about all but IE support "metaKey" as well.  So
> if you observe your link:
>
> $('linkGo').observe('click', clickHandler);
>
> ...you can tell whether a modifier key was down:
>
> function clickHandler(evt)
> {
>     alert(
>         "Control: " + evt.ctrlKey + "\n" +
>         "Shift: " + evt.shiftKey  + "\n" +
>         "Alt: " + evt.altKey  + "\n" +
>         "Meta: " + evt.metaKey);
>     evt.stop();
>
> }
>
> Stopping the event prevents the default action from happening.
> --
> T.J. Crowder
> tj / crowder software / com
>
> On Jun 9, 9:41 am, Adam <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
>
> > Is it possible to use Prototype to add control-click behaviour to a
> > link? What I want is to fire one Ajax request if a user clicks on a
> > box, and a different request if they control-click on the same box. I
> > know this is possible in some JS frameworks (e.g. Mootools), but
> > unfortunately I'm limited to Prototype - does anyone know how to do
> > this?
>
> > Many thanks,
> > Adam
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to