Represents the state of an event, such as the element in which the event occurred, the state of the keyboard keys, the location of the mouse, and the state of the mouse buttons.
Members Table
The following table lists the members exposed by the
event
object. Click a tab on the left to choose the type of member you want to view.
Attributes/Properties
| Attribute | Property | Description |
|---|
| Abstract |
Retrieves the>Abstract content of the entry banner in an
Advanced Stream Redirector (ASX) file using the event object. |
| altKey |
Sets or retrieves a value that indicates the state of the ALT key. |
| altLeft |
Sets or retrieves a value that indicates the state of the left ALT key. |
| Banner |
Retrieves the>Banner content of an
entry in an ASX file using the event object. |
| button |
Sets or retrieves the mouse button pressed by the user. |
| cancelBubble |
Sets or retrieves whether the current event should bubble up the hierarchy of event handlers. |
| clientX |
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. |
| clientY |
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. |
| contentOverflow |
Retrieves a value that indicates whether the document contains additional content after processing the current LayoutRect object. |
| ctrlKey |
Sets or retrieves the state of the CTRL key. |
| ctrlLeft |
Sets or retrieves the state of the left CTRL key.
|
| dataFld |
Sets or retrieves the data column affected by the oncellchange event. |
| fromElement | fromElement |
Sets or retrieves the object from which activation or the mouse pointer is exiting during the event. |
| keyCode |
Sets or retrieves the Unicode key code associated with the key that caused the event. |
| MoreInfo |
Retrieves the>MoreInfo content of
an entry banner in an ASX file through
the event object. |
| nextPage |
Retrieves the position of the next page within a print template. |
| offsetX |
Sets or retrieves the x-coordinate of the mouse pointer's position relative to the object firing the event. |
| offsetY |
Sets or retrieves the y-coordinate of the mouse pointer's position relative to the object firing the event. |
| propertyName |
Sets or retrieves the name of the property that changes on the object. |
| qualifier |
Sets or retrieves the name of the data member provided by a data source object. |
| reason |
Sets or retrieves the result of the data transfer for a data source object. |
| recordset |
Sets or retrieves from a data source object a reference to the default record set. |
| repeat |
Retrieves whether the onkeydown event is being repeated. |
| returnValue |
Sets or retrieves the return value from the event. |
| saveType |
Retrieves the clipboard type when oncontentsave fires. |
| screenX |
Retrieves the x-coordinate of the mouse pointer's position relative to the user's screen. |
| screenY |
Sets or retrieves the y-coordinate of the mouse pointer's position relative to the user's screen. |
| shiftKey |
Sets or retrieves the state of the SHIFT key. |
| shiftLeft |
Retrieves the state of the left SHIFT key.
|
| srcElement |
Sets or retrieves the object that fired the event. |
| srcFilter |
Sets or retrieves the filter object that caused the onfilterchange event to fire. |
| srcUrn |
Retrieves the Uniform Resource Name (URN) of the behavior that fired the event. |
| toElement |
Sets or retrieves a reference to the object toward which the user is moving the mouse pointer. |
| type |
Sets or retrieves the event name from the event object. |
| userName |
Retrieves the sFriendlyName parameter that is passed to the useService method. |
| wheelDelta |
Sets or retrieves the distance and direction the wheel button has rolled. |
| x |
Sets or retrieves the x-coordinate, in pixels, of the mouse pointer's position relative to a relatively positioned parent element. |
| y |
Sets or retrieves the y-coordinate, in pixels, of the mouse pointer's position relative to a relatively positioned parent element. |
Collections
| Collection | Description |
|---|
| bookmarks |
Returns a collection of Microsoft ActiveX® Data Objects (ADO) bookmarks tied to the rows affected by the current event. |
| boundElements |
Returns a collection of all elements on the page bound to a data set. |
Objects
| Object | Description |
|---|
| dataTransfer |
Provides access to predefined clipboard formats for use in drag-and-drop operations. |
Remarks
The event object is available only during an eventthat is, you can use it in event handlers but not in other code.
Although all event properties are available to all event objects, some properties might not have meaningful values during some events. For example, the fromElement and toElement properties are meaningful only when processing the onmouseover and onmouseout events.
In Microsoft Visual Basic® Scripting Edition (VBScript), you must access the event object through the window object.
Several of the properties that apply to this object are not writable unless this object has been created using the createEventObject method. The following is a list of these properties: altKey, altLeft, button, clientX, clientY, ctrlKey, ctrlLeft, dataFld, offsetX, offsetY, propertyName, qualifier, reason, repeat, screenX, screenY, shiftKey, shiftLeft, srcUrn, type, x, and y.
This object is available in script as of Internet Explorer 4.0.
Examples
This example uses the event object to check whether the user clicked the mouse within a link, and to prevent the link from being navigated if the SHIFT key is down.
<HTML>
<HEAD><TITLE>Cancels Links</TITLE>
<SCRIPT LANGUAGE="JScript">
function cancelLink() {
if (window.event.srcElement.tagName == "A" && window.event.shiftKey)
window.event.returnValue = false;
}
</SCRIPT>
<BODY onclick="cancelLink()">
This example displays the current mouse position in the browser's status window.
<BODY onmousemove="window.status = 'X=' + window.event.x + ' Y='
+ window.event.y">
Standards Information
object is defined in
World Wide Web Consortium (W3C) Document Object Model (DOM) Level 2
.
Applies To