Fires when the wheel button is rotated.
|Inline HTML||<ELEMENT onmousewheel = "handler" ... >
|Event property||object.onmousewheel = handler||JScript only|
|object.onmousewheel = GetRef("handler")||Visual Basic Scripting Edition (VBScript) 5.0 or later only|
<SCRIPT FOR =
object EVENT = onmousewheel>
||Internet Explorer only|
Rotate the wheel button. |
Scrolls the page up or down.|
Event Object Properties
Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query an event object for data.
Sets or retrieves a value that indicates the state of the ALT key. |
Sets or retrieves a value that indicates the state of the left ALT key.|
Sets or retrieves whether the current event should bubble up the hierarchy of event handlers. |
Sets or retrieves the x-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.|
Sets or retrieves the y-coordinate of the mouse pointer's position relative to the client area of the window, excluding window decorations and scroll bars.|
Sets or retrieves the state of the CTRL key. |
Sets or retrieves the state of the left CTRL key.
Sets or retrieves the x-coordinate of the mouse pointer's position relative to the object firing the event. |
Sets or retrieves the y-coordinate of the mouse pointer's position relative to the object firing the event. |
Retrieves the x-coordinate of the mouse pointer's position relative to the user's screen. |
Sets or retrieves the y-coordinate of the mouse pointer's position relative to the user's screen. |
Sets or retrieves the state of the SHIFT key. |
Retrieves the state of the left SHIFT key.
Sets or retrieves the object that fired the event. |
Sets or retrieves the event name from the event object. |
Sets or retrieves the distance and direction the wheel button has rolled. |
Sets or retrieves the x-coordinate, in pixels, of the mouse pointer's position relative to a relatively positioned parent element.|
Sets or retrieves the y-coordinate, in pixels, of the mouse pointer's position relative to a relatively positioned parent element.|
The onmousewheel event is the only event that exposes the wheelDelta property. This property indicates the distance that the wheel button has rotated, expressed in multiples of 120. A positive value indicates that the wheel button has rotated away from the user. A negative value indicates that the wheel button has rotated toward the user. See the example below.
The following example shows how to use the onmousewheel event and the wheelDelta parameter to expand and contract a picture in response to the wheel button being moved.
var count = 10;
count = Counting(count);
if (event.wheelDelta >= 120)
else if (event.wheelDelta <= -120)
oImage.style.zoom = count + '0%';
<img id="oImage" src="Sample.jpg" onmousewheel="Picture()" width="283"
This feature requires Microsoft® Internet Explorer 6 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
onscroll, onmousemove, onmousedown, onmouseout, onmouseover, onmouseup