Hey! I am trying to make an auto scroll for my chat program.
This is the test page.
If you are too lazy to take a look at the source, I will give it to you:
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;
};
}
Please help me!