arunforce
07-23-2009, 07:25 AM
I have a Div that goes about 5 lines, or any variable length downward. Then I set the height to 16px using
<div style='height: 16px'>a<br>c<br>d<br>e<br>g</div> works fine, but I need to find the original height before it is set using javascript.
.innerHeight reads the new value, and so does the other one I tested (I forgot what it is called).
So I thought I would set it back to it's original height by setting the style.height to null, works fine in FF, IE, and Chrome, but not Opera. I prefer a "hack-less" method, and one that works in all browsers, and the only idea I can think of is using javascript to set the height after it has been created, and read it then like:
<div id="test">a<br>c<br>d<br>e<br>g</div>
<script type="text/javascript">setHeight("test", 16)</script>
This code is pretty inefficient, a hassle, and not very elegant.
Is there an alternate way to read the original height or a cleaner and elegant way of writing the post div javascript setHeight code?
Thanks
Arun
<div style='height: 16px'>a<br>c<br>d<br>e<br>g</div> works fine, but I need to find the original height before it is set using javascript.
.innerHeight reads the new value, and so does the other one I tested (I forgot what it is called).
So I thought I would set it back to it's original height by setting the style.height to null, works fine in FF, IE, and Chrome, but not Opera. I prefer a "hack-less" method, and one that works in all browsers, and the only idea I can think of is using javascript to set the height after it has been created, and read it then like:
<div id="test">a<br>c<br>d<br>e<br>g</div>
<script type="text/javascript">setHeight("test", 16)</script>
This code is pretty inefficient, a hassle, and not very elegant.
Is there an alternate way to read the original height or a cleaner and elegant way of writing the post div javascript setHeight code?
Thanks
Arun