thrillseeker30
Apr 27th 2009, 7:25 pm
In my stylesheet, I have set the height of a div and in Javascript, I want to be able to reference that height to properly position the div in the center of the browser.
var divHeight =document.getElementById("modal_window").offsetHeight;
That is the piece of Javascript I have been using, but can't seem to get it to work. Using the alert() function, it returns an integer of 0, even though the height is set in CSS.
Any ways to fix this problem and find the height of a div using Javascript?
var divHeight =document.getElementById("modal_window").offsetHeight;
That is the piece of Javascript I have been using, but can't seem to get it to work. Using the alert() function, it returns an integer of 0, even though the height is set in CSS.
Any ways to fix this problem and find the height of a div using Javascript?