|
Q1135 If I initially set the height of a DIV to zero, then I add some text to this DIV the DIV resizes itself, how can I get the new height of the DIV?
irt.org | Knowledge Base | DHTML | Q1135 [ previous next ]
Q1135 If I initially set the height of a DIV to zero, then I add some text to this DIV the DIV resizes itself, how can I get the new height of the DIV?
Try:
<script language="JavaScript"><!--
function update() {
if (document.all)
document.all('myLayer').innerHTML = 'some text';
else if (document.layers) {
document.layers['myLayer'].document.open();
document.layers['myLayer'].document.writeln('some text');
document.layers['myLayer'].document.close();
}
}
function size() {
if (document.layers)
alert('height = ' + document.layers['myLayer'].document.height);
else if (document.all)
alert('height = ' + document.all['myLayer'].offsetHeight);
}
//--></script>
<div id="myLayer" style="position:absolute; height:0" height="0"></div>
<br><br><br>
<form>
<input type="button" value="Update" onClick="update()">
<input type="button" value="Size?" onClick="size()">
</form>
|
Feedback on 'Q1135 If I initially set the height of a DIV to zero, then I add some text to this DIV the DIV resizes itself, how can I get the new height of the DIV?'
|
|
Copyright © 1996-2008 irt.org, All Rights Reserved.