Getting Image size in Javascript not working the first time
<p>I am getting the image size using javascript, but it won't return the correct size until after I run it a second time.  I wonder why this is.  Here is my code:</p>

<pre><code>   var img = new Image()
   img.src = src
   img.onLoad = alert(img.width);
</code></pre>

<p>This returns <code>0</code> sometimes, but after a couple times it returns the actual image width.  How do I make it get the right size the first time?  I thought this was the right way.</p>
