How can I determine the absolute position of an element within an iframe taking in to account the frame's scroll in javascript?
<p>I'd like to know the absolute position (pixels from top and left) of a HTML element within an iFrame that has scrolled. I've tried using the 'findpos' script from quirksmode (<a href="http://www.quirksmode.org/js/findpos.html" rel="nofollow">http://www.quirksmode.org/js/findpos.html</a>):</p>

<pre><code>function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        do {
            curleft += obj.offsetLeft;
            curtop += obj.offsetTop;
        }
        while (obj = obj.offsetParent);
        return [curleft, curtop];
    }
}
</code></pre>

<p>This doesn't seem to account for the fact that the iFrame may have scrolled. How can I modify this script to account for the scroll of the iFrame?</p>
