title: How to pass parameters into image load event?
body: <p>When I set the src of an image object, it will trigger an onload function. How can I add parameters to it?</p>
  
  <pre><code>x = 1;
  y = 2;
  imageObj = new Image();
  imageObj.src = ".....";
  imageObj.onload = function() {
      context.drawImage(imageObj, x, y);
  };
  x = 3;
  y = 4;
  </code></pre>
  
  <p>In here, I want to use the x and y values that were set at the time I set the src of the image (i.e. 1 and 2). In the code above, by the time the onload function would finish, x and y could be 3 and 4.</p>
  
  <p>Is there a way I can pass values into the onload function, or will it automatically use 1, and 2?</p>
  
  <p>Thanks</p>