From: David T. <dav...@fr...> - 2004-11-08 08:30:42
|
Hi to all, Is there a way to get the absolute position to an element inserted with DynAPI.document.addInflowChild(DynElement) The only way i find is finding absolute position of one of the container. <DIV = "id">DynAPI.document.addInflowChild(DynElement)</DIV> divobj = document.all[id]; x = findPosX(divobj) y = findPosY(divobj); function findPosX(obj) { var curleft = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft obj = obj.offsetParent; } } else if (obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop; } Isn't it a more elegant way to find the DynElement Absolute position from the screen ?? |