C
Chris
I'm trying to display a large amount of text in a scrolling DIV. I want the
scrollbar positioned at the bottom when the page is first displayed. My
DHTML reference suggests this can be done using the scrollTop property. I
just can't figure out how to use it.
These three attempts didn't work:
<div scrollTop=1000>block of text</div>
<div style="scrollTop : 1000">block of text</div>
<div id="log">block of text</div>
<script>
document.getElementById("log").scrollTop=1000;
</script>
This is the only thing that *does* work, but I have to click a link to get
it to go:
<div id="log">block of text</div>
<script>
function scroll() {
document.getElementById("log").scrollTop=1000;
}
</script>
<a href="javascript:scroll()">click here</a>
There's got to be some simple syntax that I'm missing.
scrollbar positioned at the bottom when the page is first displayed. My
DHTML reference suggests this can be done using the scrollTop property. I
just can't figure out how to use it.
These three attempts didn't work:
<div scrollTop=1000>block of text</div>
<div style="scrollTop : 1000">block of text</div>
<div id="log">block of text</div>
<script>
document.getElementById("log").scrollTop=1000;
</script>
This is the only thing that *does* work, but I have to click a link to get
it to go:
<div id="log">block of text</div>
<script>
function scroll() {
document.getElementById("log").scrollTop=1000;
}
</script>
<a href="javascript:scroll()">click here</a>
There's got to be some simple syntax that I'm missing.