hi, i'm writing an app that needs the coordinates of DOM elements. given some DOM node (image, text, table, etc.) and the rendered page, i'd like to find out the coordinate of the upper-left hand corner and the width/height of the node. is there API to do this? thank you.
Try using the boxObject associated with the element node. You need to subtract the scroll position of all parent containers (bug #186229)
function getScreenLeft( el )
{
// we need to sum up all scrollLeft on all parent nodes
var sum = 0;
var p = el.parentNode;
while ( p.nodeType == 1 )
{
sum += p.scrollLeft;
p = p.parentNode;
}
return document.getBoxObjectFor( el ).screenX - sum;
}erik _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom
