When developing an interactive web application with a windows like user interface you may need to know when a mouse button has been pressed, and when it has, which one.
Here is how this code can be used in the real world. Most mice now days have done away with the middle button anyway, so you can now simply detect whether or not the right or left hand button has been pressed:
var status = document.getElementById("status");
if(event.button == 2)
status.innerHTML = "The right mouse button has been pressed.";
status.innerHTML = "The left mouse button has been pressed.";