homepage Welcome to WebmasterWorld Guest from 54.235.227.60
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
how to get_absolute_left(float + offsetLeft)
Xuefer




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

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?

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved