title: Trying to access variables outside the function in Javascript
body: <p>I am using the following snip of Javascript from another SO answer:</p>
  
  <pre><code>var _URL = window.URL || window.webkitURL;
  $("#file").change(function (e) {
      var file, img;
      if ((file = this.files[0])) {
          img = new Image();
          img.onload = function () {
              alert(this.width + " " + this.height);
          };
          img.src = _URL.createObjectURL(file);
      }
  });
  </code></pre>
  
  <p>I cannot figure out how to get access to those this.width and this.height variables outside of the function.  I have set them equal to existing variables and the variables are always 0 or null.</p>