westman Posted March 20, 2012 Share Posted March 20, 2012 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 More sharing options...
dsonesuk Posted March 20, 2012 Share Posted March 20, 2012 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 More sharing options...
westman Posted March 20, 2012 Author Share Posted March 20, 2012 nice i like it but it targets the body of my page, how do i target <div>text_output</div>? Link to comment Share on other sites More sharing options...
dsonesuk Posted March 20, 2012 Share Posted March 20, 2012 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 More sharing options...
westman Posted March 20, 2012 Author Share Posted March 20, 2012 thank you so much last Q.what site or where is the best place to learn javascript?like to learn php we have http://www.php.net Link to comment Share on other sites More sharing options...
eTianbun Posted March 20, 2012 Share Posted March 20, 2012 Goto: w3schools.com for a start! Link to comment Share on other sites More sharing options...
123662981 Posted March 21, 2012 Share Posted March 21, 2012 Agree with the upper floor!! :good:This site is good for the beginner like me who are interested with JS, CSS etc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.