View Single Post
12-30-2009, 05:48 PM
#2
Gaz is offline Gaz
Gaz's Avatar
Status: Request a custom title
Join date: Apr 2007
Location: UK
Expertise: Code & Programming
Software: Coda, TextMate, Sublime 2
 
Posts: 2,097
iTrader: 26 / 100%
 

Gaz will become famous soon enough Gaz will become famous soon enough

Send a message via Skype™ to Gaz

  Old

Quirksmode has a good section on this:
http://www.quirksmode.org/js/events%...es.html#button

Another good article:
http://unixpapa.com/js/mouse.html

Google also helps
http://www.google.com/search?q=middl...ent+javascript

However, I'd use jQuery.
Code:
$("#foo").live('click', function(e) { 
   if( e.which == 2 ) {
      e.preventDefault();
      alert("middle button"); 
   }
});
.. where preventDefault() function prevents the default function of the middle click (the alert can be removed).

Hope that helps

Reply With Quote