HTML DOM scrollBy() Method
Complete Window Object Reference
Definition and Usage
The scrollBy() method is used to scroll the content by the specified number
of pixels.
Note: The visible property of the window's scrollbar must
be set to true if using this method!
Syntax
Parameter |
Description |
xnum |
Required. How many pixels to scroll by, along the x-axis |
ynum |
Required. How many pixels to scroll by, along the y-axis |
Example
The following example scrolls the content by 100 pixels:
<html>
<head>
<script type="text/javascript">
function scrollWindow()
{
window.scrollBy(100,100)
}
</script>
</head>
<body>
<input type="button" onclick="scrollWindow()" value="Scroll" />
<p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
</body>
</html>
|
Try-It-Yourself Demos
Scroll the window with scrollBy()
Complete Window Object Reference
 |

|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|