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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to find out the height of an element?

Status
Not open for further replies.

cheerful

Programmer
Joined
Mar 4, 2003
Messages
173
Location
US
I would want to fit everything on a single page and make the image as large as possible. There is on DIV element under the image. How can I find out the height of the DIV element?

Thanks!
 
offsetHeight

given:

<div id="myDiv">foo</div>

use:

var divHeight = document.getElementById("myDiv").offsetHeight;

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Thanks!

What is the different among offsetHeight, scrollHeight and some other height attribute? Where can I find information on such subject?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top