Auto scroll! Not working..!
Posted: Thu Mar 25, 2010 10:12 am
Hey! I am trying to make an auto scroll for my chat program.
Here is the test page.
If you are too lazy to take a look at the source, I will give it to you:
Please help me!
Here is the test page.
If you are too lazy to take a look at the source, I will give it to you:
Code: Select all
var DS = document.getElementById('div_scroll');
var de = document.getElementById('deb');
var date = new Date();
doAgain();
function doAgain(){
date = new Date();
ms = date.getTime();
setTimeout('doAgain();',1000);
var s_top = DS.scrollTop;
var s_height = DS.scrollHeight;
var o_height = DS.offsetHeight;
var scrollTemp = s_top;
DS.innerHTML += ms+'<br>';
//Check& scroll:
de.innerHTML = (scrollTemp == s_height-o_height)+'<br>s_top: '+s_top+'<br>s_height: '+s_height+'<br>o_height: '+o_height;
if(scrollTemp == s_height-o_height){
DS.scrollTop =s_height-o_heigth;
};
}