Auto scroll! Not working..!

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
3rlend
Forum Newbie
Posts: 2
Joined: Mon Mar 22, 2010 3:04 pm

Auto scroll! Not working..!

Post by 3rlend »

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:

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;
    };
}
 
Please help me!
Post Reply