Thursday, December 22nd, 2005
Quick Tip: Scroll to Bottom of a Div
Eric Pascarello has a nice tip on how to scroll to the bottom of a div.
var objDiv = document.getElementById(“divExample”);
objDiv.scrollTop = objDiv.scrollHeight;





4.2 rating from 48 votes
and if you want to find out stuff like that you can use the mozilla dom inspector.
When you select a node and choose “Javascript Object” on the right hand menu, you get all javascript methods and properties of the node.
Does this work cross browser and cross doctype (i.e. standards compliant mode in IE 6 versus quirks mode)? The screen coordinate properties are ‘quirky’ to say the least.
The prototype way…
with ($(“divExample”)) {scrollTop = scrollHeight;}
Oh my god! Thank you for this, helped tremendously!