title: mousemove and cross-browser e.which
body: <p>I need to know which mouse key is pressed on every mousemove event, and I try to use this:</p>
  
  <pre>
  
      getMouseCode: function(e) {
          e = e || window.event;
          if (!e.which && e.button) {
              if      (e.button & 1) e.which = 1;
              else if (e.button & 4) e.which = 2;
              else if (e.button & 2) e.which = 3;
          };
          return e.which;
      },
  
  </pre>
  
  <p>But this is works only in chrome and IE7-8. IE9 debugger always says e.button == 0 and e.which == 1. After some debugging I figured out that window.event for IE9 contains right value of which, so I swapped </p>
  
  <pre>
  
  e = window.event || e;
  
  </pre>
  
  <p>This also does the trick for Safari &amp; Air, but Firefox has window.event undefined, and Opera has the same wrong values in both callback argument and window.event objects.</p>