kdjoergensen
01-07-2001, 06:03 PM
Following work in netscape 6:
<div id="aa" style="position: absolute;"><div id="bb">Here is a layer</div></div>
var w = document.getElementById('aa').offsetWidth;
var w2 = document.getElementById('bb').offsetWidth;
However, if the nested layer (id="bb") is also set to position: absolute the width returned for both elements are ZERO.
<div id="aa" style="position: absolute"><div id="bb" style="position: absolute">Here is a layer</div></div>
var w = document.getElementById('aa').offsetWidth;
var w2 = document.getElementById('bb').offsetWidth;
above will return zero (0) for both elements.
Now, why would anyone in their right mind nest two absolutely positioned elements to begin with ? - I don't know, but that should still not affect the width of the element ?
Anyone have had similar experiences ?
[This message has been edited by kdjoergensen (edited 01-07-2001).]
<div id="aa" style="position: absolute;"><div id="bb">Here is a layer</div></div>
var w = document.getElementById('aa').offsetWidth;
var w2 = document.getElementById('bb').offsetWidth;
However, if the nested layer (id="bb") is also set to position: absolute the width returned for both elements are ZERO.
<div id="aa" style="position: absolute"><div id="bb" style="position: absolute">Here is a layer</div></div>
var w = document.getElementById('aa').offsetWidth;
var w2 = document.getElementById('bb').offsetWidth;
above will return zero (0) for both elements.
Now, why would anyone in their right mind nest two absolutely positioned elements to begin with ? - I don't know, but that should still not affect the width of the element ?
Anyone have had similar experiences ?
[This message has been edited by kdjoergensen (edited 01-07-2001).]