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
Want To Be A Web Master?
If you want to be a Web Master, you will have to host your web site with an ISP (Internet Service Provider).
MaximumASP offers seven different configurations of dedicated servers to meet your Windows and .NET hosting needs.
Hosted on our multi-tiered Enterprise Class network, these servers provide the performance, security and reliability
you need to host your high end web sites and applications.
Visit MaximumASP
|