[thelist] pushing scrollbar to bottom
Kowalkowski, Lee (ASPIRE)
lee.kowalkowski at hmrcaspire.com
Wed Oct 19 08:10:55 CDT 2005
> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Alex Beston
> Sent: Wednesday, October 19, 2005 12:06 PM
>
> Im trying to work out how to push the scroll bar to the
> bottom of a long
> bit of text, say more than 1 page long. equivalent of
> pressing the ctrl
> + end buttons
>
> is it scriptable? tried vertical align: bottom but no joy
>
I've done something like this before:
<script>
function log(str)
{
var console = document.getElementById("console");
if(console)
{
console.value += str + '\n';
console.scrollTop = console.scrollHeight - console.clientHeight;
}
}
setInterval("log(Math.random());", 500);
</script>
<body>
<textarea id="console" rows="10"></textarea>
</body>
Not all browsers have the scrollTop, scrollHeight & clientHeight properties,
depends on your requirements. Works in IE & Firefox. This example is
controlling the scrollbar on a textarea, but it should work for any
scrollable element.
-LK
===========================================================
Our e-mail domain has now changed from iraspire.com to hmrcaspire.com. Please update your address books.
===========================================================
More information about the thelist
mailing list