PhantomSnake (talk | contribs) mNo edit summary |
PhantomSnake (talk | contribs) mNo edit summary |
||
Line 24: | Line 24: | ||
while (obj.offsetParent) | while (obj.offsetParent) | ||
{ | { | ||
curleft += obj.offsetLeft | curleft += obj.offsetLeft; | ||
obj = obj.offsetParent; | obj = obj.offsetParent; | ||
} | } | ||
} | } | ||
else if (obj.x) | else if (obj.x) { | ||
curleft += obj.x; | curleft += obj.x; | ||
} | |||
return curleft; | return curleft; | ||
} | } | ||
Line 40: | Line 41: | ||
while (obj.offsetParent) | while (obj.offsetParent) | ||
{ | { | ||
curtop += obj.offsetTop | curtop += obj.offsetTop; | ||
obj = obj.offsetParent; | obj = obj.offsetParent; | ||
} | } | ||
} | } | ||
else if (obj.y) | else if (obj.y) { | ||
curtop += obj.y; | curtop += obj.y; | ||
} | |||
return curtop; | return curtop; | ||
} | } |
Revision as of 17:39, 28 June 2006
<plainhtml>
<script type="text/javascript">
var useFloats = true;
function findRelPosX(obj) { var relleft = 0;
if (obj.offsetParent) { relleft = obj.offsetLeft; } else if (obj.x) { relleft = obj.x; }
return relleft; }
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; }
</script>
</plainhtml>