window.scroll

Syntax window.scroll (dir, count)

Params dir direction (up, down, left or right) to scroll the target window.

count number of iterations to scroll the window in the indicated direction, where each count is the equivalent of the user pressing on the directional arrow in the scrollbar area one time.

Action Scrolls the target window in the indicated direction, the indicated number of times if possible.

Returns True if it is possible to scroll in the indicated direction at least once, false otherwise.

Examples Open the word processing text document called examples.letter. Reduce the size of its window so there is room to scroll in all four directions. Now type and execute:

window.scroll (up, 1) // the text scrolls up

   » true

window.scroll (down, 1) // the text scrolls down

   » true

window.scroll (left, 1) // the text scrolls left

   » true

window.scroll (right, 1) // the text scrolls right

   » true

window.scroll (up, infinity)

   » true

window.scroll (down,infinity)

   » true

Notes If it is not possible to scroll count times in the given direction, this verb will scroll as far as possible and return true.

Discuss