I hate this mess with the mouse buttons created by W3C an MS! I want to know if the left mouse button is pressed when I get a mousedown event.
I use this code
// Return true if evt carries left mouse button press
function detectLeftButton(evt) {
// W3C
if (window.event == null) {
return (evt.button == 0)
}
// IE
else {
return (evt.button == 1);
}
}
However, it does not work in Opera and Chrome, because it so happens that window.event exists there too.
So what do I do? I have some browser detection, but we all know it cannot be relied upon with all the masking some browsers do lately. How do I detect the left mouse button RELIABLY?