finding the top left corner position of an image
<p>I have an image that is encapsulated in a <code>&lt;a href=""&gt;&lt;img src=""/&gt;&lt;/a&gt;</code>. There may be one or more div above/below this image. How do I find the top left position of this image? by top left I mean the x and y coordinate position of this image. And I want to use javascript only, no jQuery and only the simplest solution only (with the fewest number of lines). What I have in mind is the following:</p>

<pre><code>topleftImgX = img.offsetTop - img.parentNode.scrollTop;
topleftImgY = img.offsetLeft = img.parentNode.scrollLeft;
</code></pre>

<p>is this correct? Again javascript only, no jQuery</p>
