[thelist] get height of div with js after changing it?

.jeff jeff at members.evolt.org
Thu Aug 15 14:25:01 CDT 2002


craig,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Saila, Craig
>
> Theoretically, what you're doing should work, for
> example, if DIV[id="test"] has the height declared
> inline (or via JS), this finds both the old and new
> value:
>  nObj = document.getElementById("test")
>  alert(nObj.style.height)
>  nObj.style.height = "400px"
>  alert(nObj.style.height)
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

this example works because you're explicitly setting the new height value.  however, if the height is changed because the contents of the object change, forcing it to grow, the height property will not reflect the new height.  the same thing happens if you specify a height in css less than the height of the contents of an object.  grabbing that value from scripting will give you the height set in css and not the actual height.

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list