S
Simon Wigzell
I have a simple page where the user adds a comment to a form that gets saved
in a database, the page refreshes and reads the contents of the database and
displays them inside a scrolling div.
The following piece of code simulates some text inside a div where the text
is longer than the div is high. I would like to force the display to the end
of the - as if the user had scrolled to the end - when the page refreshes.
What is the property of the div that controls the position of the text
inside it and how do I set this to the end with javascript? IF this was a
text area then I could just say:
document.all.Comments.scrollHeight = 10000;
I think. I am using a div instead of a text area because the text I am
displaying will contain html.
Thanks!
<div id="Comments" style="background-color: #FFFFDD; border: inset 2px
#999999; overflow:auto; width=200; height=100;">
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
</div>
in a database, the page refreshes and reads the contents of the database and
displays them inside a scrolling div.
The following piece of code simulates some text inside a div where the text
is longer than the div is high. I would like to force the display to the end
of the - as if the user had scrolled to the end - when the page refreshes.
What is the property of the div that controls the position of the text
inside it and how do I set this to the end with javascript? IF this was a
text area then I could just say:
document.all.Comments.scrollHeight = 10000;
I think. I am using a div instead of a text area because the text I am
displaying will contain html.
Thanks!
<div id="Comments" style="background-color: #FFFFDD; border: inset 2px
#999999; overflow:auto; width=200; height=100;">
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
Some Text<br>
</div>