reset Height to nothing
I hit a small bump in my code.
How can I reset a height property back to nothing ?
if my div was..
I tryied setting .height = "";
<div id="test" stye="height:550px; border:1px solid #000;"> some text 550 px long...</div>
But its not working in IE6
Any ideas ?
Last edited by cgishack; 02-18-2008 at 11:35 AM.
your missing a closing quote on that ID :P
document.getElementById("test").style.height = '0px';
edit: quote not bracket. silly me.
Ahh.. sorry. That was me just typing the example. The code had the correct syntax.
I think I solved my problem though.
element.height =""; does reset the div to nothing....
It may have been just a browser cache issue.
Thanks for the reply though.
You can always set the height to auto.
true.. i think it was just one of those days..
You can also reset the height to null
document.getElementById("test").style.height = null;
not recomended because of the way some less common browsers handle that(turning null into a string 'null' before assigning it).
Originally Posted by scragar
I have never come across it myself, it was documented somewhere(although I cannot find it any more)...
ok, never mind... Anyway, you are right. A stringed value should be safer in that case. I was just remembered the null possibility...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)