Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Layer Properties

Status
Not open for further replies.

Light777

Programmer
May 15, 2003
32
0
0
US
I am trying to get the height or width or left or top of a layer that has not been explicitly set or has been set to a percentage.

i.e.

#DIV {position: absolute; width: 100%}

<div id="DIV">
</div>

I am changing the innerHTML of this layer and then trying to get the height so I can lay out the page without overlapping. When I use:

alert(document.getElementById("DIV").style.height);

I get the error message:

"style.height" is null or not an object.

Why is this happening?
 
Nevermind, I wrote the wrong alert. However, I'm not getting anything for style.height, as a string it would be "". When I use style.offsetHeight, I get an undefined error. Is there anyway around this?
 
u dont get style.height as "" as it is not set.

its document.getElementById(...).offsetHeight

offsetHeight is not a subset of style...

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top