IE clientheight problem

B

brianwmunz

I'm trying to dynamically change the height of a div, and I have it
working in Firefox, but IE isn't letting me get the clientHeight of the
div. When I do an alert to check the clientHeight of the div, it tells
me 0.
Here is the function (at least the part that tries to get the height):

function resizeDivs(divnum){
var branddivid = 'branddiv' + divnum;
var branddiv = document.getElementById(branddivid);
var divheight = branddiv.clientHeight;
alert(divheight);
}
 
J

jeffcbeck

Hi Brian,

I recently ran into the same problem... and happily found a solution!
The problem has nothing to do with your code; it's correct. The
problem is that IE only keeps track of "certain" clientHeights...
depending on if the element "has layout". You can read all about it
at:

http://www.satzansatz.de/cssd/onhavinglayout.html

The quick answer to your problem is to make sure the 'branddiv'
elmenents have a 'display: inline-block' style set in them. This will
force the elements to "have layout", which in turn will force IE to
record the elements height.

Good luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top