I have this simple script:
var o = document.getElementById("content");
if (o.clientHeight == "372") {
o.style.height = "328px";
o.style.marginBottom = "44px";
} else {
o.style.height = "214px";
o.style.marginBottom = "32px";
}
but somehow the ELSE always executes, even if the initial height of my div is 372px…
can anyone help me?
clientHeighttakes padding into account. You may want to usescrollHeight,offsetHeight, orstyle.height, depending on your needs. Note thatstyle.heightdoes not return an integer like the others.http://help.dottoro.com/ljcadejj.php