DOM:window.scroll
From MDC
(Difference between revisions)
| Revision as of 00:40, 11 August 2005 Dria (Talk | contribs) � Previous diff |
Current revision Jabez (Talk | contribs) Example |
||
| Line 10: | Line 10: | ||
| ==Example == | ==Example == | ||
| <pre> | <pre> | ||
| - | // put the 1000th vertical pixel at | + | // put the 100th vertical pixel at the top of the window |
| - | // the top of the window | + | <button onClick="scroll(0, 100);">click to scroll down 100 pixels</button> |
| - | <INPUT TYPE="button" VALUE="1000" | + | |
| - | onClick="scroll(0, 1000);"/> | + | |
| </pre> | </pre> | ||
| + | |||
| ==Notes == | ==Notes == | ||
| [[window.scrollTo]] is effectively the same as this method. | [[window.scrollTo]] is effectively the same as this method. | ||
Current revision
« Gecko DOM Reference
Contents |
[edit]
Summary
Scrolls the window to a particular place in the document.
[edit]
Syntax
window.scroll(x-coord, y-coord)
[edit]
Parameters
x-coordis the pixel along the horizontal axis of the document that you want displayed in the upper left.y-coordis the pixel along the vertical axis of the document that you want displayed in the upper left.
[edit]
Example
// put the 100th vertical pixel at the top of the window <button onClick="scroll(0, 100);">click to scroll down 100 pixels</button>
[edit]
Notes
window.scrollTo is effectively the same as this method. For scrolling a particular distance repeatedly, use the window.scrollBy. Also see window.scrollByLines, window.scrollByPages.
[edit]
Specification
DOM Level 0. Not part of specification.
Categories: Gecko DOM Reference