Welcome to WebmasterWorld Guest from 174.129.151.95

Forum Moderators: open

Message Too Old, No Replies

how to get_absolute_left(float + offsetLeft)

   
5:29 am on Apr 11, 2006 (gmt 0)

10+ Year Member



there is an example code in msdn that tell u how to calc absolute top/left of a specified element.

function calc...(o) {
var l = o.offsetTop;
var p = o.offsetParent;

while (p!= null) {
if (ie && p.tagName == "TD") {
l += p.clientTop;
}
l += p.offsetTop;
p = p.offsetParent;
}
}

but it won't work with


<div style="float: left">abc</div>
<div style="float: right">123</div>
<div style="float: left">def<div id="obj">calc me</div></div>

how do u calc the obj?