How to move the div's scroll to bottom?

Posted on 2007-07-28
Medium Priority
Last Modified: 2010-05-18
How to move the div's scroll to bottom?
Question by:apnamian
1 Comment
LVL 14

Accepted Solution

bugs021997 earned 2000 total points
ID: 19584286
Try this....

var objDiv = document.getElementById("divExample");
objDiv.scrollTop = objDiv.scrollHeight;


var mydiv = document.getElementById("mydiv");
mydiv.scrollTop = mydiv.scrollHeight - mydiv.clientHeight;


<BODY onLoad="document.getElementById('news').scrolltop=document.getElementById('news').scrollHeight-document.getElementById('news').clientHeight">
<div style="overflow:auto;width:200px;height:300px;border:1px solid black;font-size:10px;font-family:arial" id="news">Event 1<br><br><BLOCKQUOTE>Blah blah blah</BLOCKQUOTE><br><br>Event 2<br><br><BLOCKQUOTE>Blah blah blah</BLOCKQUOTE><br><br>Event 3<br><br><BLOCKQUOTE>Blah blah blah</BLOCKQUOTE><br><br>Event 4<br><br><BLOCKQUOTE>Blah blah blah</BLOCKQUOTE><br><br>Event 5<br><br><BLOCKQUOTE>Blah blah blah</BLOCKQUOTE><br><br>Event 6<br><br><BLOCKQUOTE>Blah blah blah</BLOCKQUOTE><br><br>Event 7<br><br><BLOCKQUOTE>Blah blah blah</BLOCKQUOTE><br><br></DIV>

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Over time, the online landscape has altered considerably, but that’s nothing compared to the up-and-coming trends that will shape the web design industry in the coming year. Keep reading to find out which trends will shape B2B web design in 2018.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question