What is the sample JavaScript code for a web page to be scroll down automatically?

What is the sample JavaScript code for a web page to be scroll down automatically?

(Or when click on vertical scroll bar). Please provide code for similar functionality.

Thanks.

One Response to “What is the sample JavaScript code for a web page to be scroll down automatically?”

  • Rockstar:

    window.scrollBy(0,0);

    First 0 is your x, or width, scroll, second 0 is your y, or height, scroll, in characters or rows. This will actually scroll.

    window.scroll(0,0);

    This does the same thing, only it jumps to that part of the page instead of scrolling, so the animated effect of scrolling does not occur.

    Scroll by a button:

    function scrollDown(){
    window.scroll(0,10);
    }

    function scrollStop(){
    clearInterval(scolling);
    }

    In the button, set an interval and a clear:

    <input type="button" value="v" onmousedown="var scrolling=window.setInterval(‘scrollDown()’, 50);" onmouseup="scrollStop();" />

Leave a Reply