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 ??



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to