JavaScript: Getting the right object when handling events
<p>So, I have code like this:</p>

<pre><code>function Shape() {
  ...
  var canvas = document.getElementById('canvas');
  ...

  canvas.onmousedown = handleMouseDown;       

}

function handleMouseDown(e) {
  this.width // Doesn't refer to the shape
  // How do I get a reference to the shape here?
}
</code></pre>

<p>Question - how do I get a reference to the Shape in my event handler?</p>
