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