Jump to content

fix scroll bar to the bottum


westman
 Share

Recommended Posts

hi all,i have a <div>and in it, it looks like this...

<div id="text_output" align="left" style="background-color:#F4F4F4; font-size:12px; height:150px; overflow:auto; padding:5px; border-bottom:#666 1px solid;"> 

how do i set the scroll bar found on the right hand side of the page to the bottum? note. like when you open a new website the scroller is at the top showing the top of the page, am trying to show the bottum of the page (div) ps. i did post this under css but found out its not css, sorry for spam.

Link to comment
Share on other sites

use window.scrollTo(0,document.body.scrollHeight);

<script language="javascript" type="text/javascript">function text_info( theword) {window.scrollTo(0,document.body.scrollHeight);output = document.getElementById("text_output");var update = "update"var new1 = "hello"var new2 = theword;var url = "test.php";$.post(url,{ update: update, new1: new1, new2: new2 }  ,  function(data) {output.innerHTML += data+'<br />';});var timer = setTimeout("text_info('"+theword+"')",5000); // every 1000 = 1 sec, so 5000 = 5sec}</script>

Link to comment
Share on other sites

function text_info( theword) {output = document.getElementById("text_output");output.scrollTop=output.offsetHeight;var update = "update"var new1 = "hello"var new2 = theword;var url = "test.php";$.post(url,{ update: update, new1: new1, new2: new2 }  ,  function(data) {output.innerHTML += data+'<br />';});output.scrollTop=output.offsetHeight;var timer = setTimeout("text_info('"+theword+"')",2000); // every 1000 = 1 sec, so 5000 = 5sec}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...