Prototype provides a handy isLeftClick() function as a part of the Event 
object extensions that you can use.  Plus, if I understand the API 
correctly, isLeftClick() doesn't actually refer to the left button but 
rather the button that doesn't ivoke the context menu thus providing 
support for both left-handed and right-handed mice.

http://prototypejs.org/api/event/isLeftClick

 -- Dash --

Walter Lee Davis wrote:
> I have a bit of code that invokes the In Place Editor when you 
> right-click on a div:
>
> var rightClick = function(e){
>       var field = this.id;
>       var tall = Math.ceil(Element.getHeight(this)/24);
>       tall = (tall > 30)? 30 : tall;
>       Event.stop(e);
>       var editListing = new Ajax.InPlaceEditor(field, "ajax_update.php", {
>               rows:tall,cols:50,
>               onComplete: function(transport, element) {
>                       new Effect.Highlight(element, {
>                               startcolor: this.options.highlightcolor
>                       });
>                       editListing.dispose();
>               },
>               loadTextURL: "get_raw.php?id=<?= $id ?>&class=<?= $class 
> ?>&field=" + 
> field,
>               ajaxOptions: {
>                       method: "post"
>               },
>               callback: function(form, value) {
>                       return "id=<?= $id ?>&class=<?= $class ?>&field=" + 
> field + 
> "&myparam=" + encodeURIComponent(value)
>               }
>       });
>       if(editListing) editListing.enterEditMode('click');
> };
> var editThis = function(){
>       //alert('boo');
>       Event.observe('title','contextmenu',rightClick);
>       Event.observe('intro','contextmenu',rightClick);
>       Event.observe('body_text','contextmenu',rightClick);
> };
> Event.observe(window,'load',editThis);
>
> This all works great -- on a Mac. But I just tried on Windows, and 
> apparently the contextmenu bit is not enough to trigger the function on 
> IE6 (haven't tried IE7 yet).
>
> What do I need to add to my Event.observe call to capture the 
> right-click event on the Other platform?
>
> Thanks in advance,
>
> Walter
>
>
> >
>
>   

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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