How to use Window Object Scroll in JavaScript

In this article I am going to explain about window object scroll() method.
  • 1193

JavaScript Window Object ScrollBy() Method

JavaScript ScrollBy() method use for scroll the content on the page. Scroll size set defined specifies number of pixel. For scroll the content browser properties must be true.

Syntax

 

scrollBy(X,Y)

Example

<html>

<head>

    <script type="text/javascript">

        function scrollWindow() {

            window.scrollBy(75, 75);

        }

    </script>

</head>

<body>

    <button onclick="myfun()">

        click me</button>

    <p>

        Window object Scroll() method</p>

    <br />

    <br />

    <br />

    <p>

        Window object Scroll() method</p>

    <br />

    <br />

    <br />

    <br />

    <p>

        Window object Scroll() method</p>

    <br />

    <br />

    <br />

    <br />

    <p>

        Window object Scroll() method</p>

    <br />

    <br />

    <br />

    <br />

    <p>

        Window object Scroll() method</p>

    <br />

    <br />

    <br />

    <br />

    <p>

        Window object Scroll() method</p>

    <br />

    <br />

    <br />

    <p>

        Window object Scroll() method</p>

    <br />

    <br />

    <br />

    <br />

</body>

</html>

 

Output

 

scroll.gif


You may also want to read these related articles: here
 
Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2013 dotNetheaven. All rights reserved.