DHTML Events
Occurs when a document view is scrolled.
Inline HTML |
<element onscroll = "handler" ... > |
All platforms |
Event property |
object.onscroll = handler |
ECMA-262 Language Specification |
Named script |
<script FOR=object EVENT=onscroll> |
Internet Explorer® only |
Bubbles |
No |
Cancels |
No |
To invoke |
Begin scrolling in the object that has a scroll bar.
- Click and drag the scroll box with the mouse.
- Click the scroll arrow.
- Click the scroll bar.
- Invoke the doScroll method.
- Press PAGE UP or PAGE DOWN.
- Press the ARROW UP or ARROW DOWN until scrolling occurs.
|
Default action |
Scrolls the contents of an object until new portions of the object become visible. |
A scroll event fires whenever the scroll box is repositioned in the scroll bar.
Programmatic control of scroll bar components is provided by the componentFromPoint and doScroll methods.
CSS enables scrolling on all objects through the overflow property. Such objects are not listed in the Applies To list for this event.
While event handlers in the Document Object Model do not receive parameters directly, the handler can query the event object for data.
Event Object Properties
clientX |
Retrieves the x-coordinate of the position of the cursor when the mouse is clicked, relative to the size of the client area of the window but excluding window decorations or scroll bars. |
clientX |
Returns the y-coordinate of the position of the cursor when the mouse is clicked, relative to the size of the client area of the window but excluding window decorations or scroll bars. |
offsetX |
Retrieves the horizontal coordinate of the mouse's position relative to the object firing the event. |
offsetX |
Retrieves the vertical coordinate of the mouse's position relative to the object firing the event. |
screenX |
Retrieves the horizontal position of the mouse, in pixels, relative to the user's screen. |
screenY |
Retrieves the vertical position of the mouse, in pixels, relative to the user's screen. |
srcElement |
Retrieves the object that fired the event. |
type |
Retrieves the event name from the event object. |
x |
Returns the horizontal position of the mouse when the event fires. |
y |
Returns the vertical position of the mouse when the event fires. |
APPLET, BDO, BODY, DIV, EMBED, HTMLAREA, MAP, MARQUEE, OBJECT, SELECT, TABLE, TEXTAREA
componentFromPoint, doScroll