You are here: Reference > JavaScript > client-side > HTML DOM > methods > scrollByPages

scrollByPages method

Browser support:
Scrolls the contents of the document vertically by the specified number of pages.
This method performs the same action as when the page-down or page-up region of the vertical scrollbar is clicked.
In Internet Explorer, use the doScroll method to simulate a user action on a scroll-bar component.
The scrollByPages method is only supported by Firefox, use the cross-browser scrollBy method instead.

Syntax:

object.scrollByPages (numberOfPages);
You can find the related objects in the Supported by objects section below.

Parameters:

numberOfPages
Required. Integer that specifies the number of pages to scroll.

Return value:

This method has no return value.

Example HTML code 1:

This example shows how to scroll the document window by the specified number of pages:
<span>First line.</span>
<button onclick="window.scrollByPages (1);">Scroll the document vertically by one page!</button>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<span>Second line.</span>
<button onclick="window.scrollByPages (1);">Scroll the document vertically by one page!</button>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<span>Third line.</span>
<button onclick="window.scrollByPages (1);">Scroll the document vertically by one page!</button>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<span>Fourth line.</span>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content