Language References
DOM Level 2 Specification.
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.
The event object is available only during an event. That 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 VBScript you must access the event object via the window object.
event Members
The following example checks whether a mouse click occurred within a link and prevents the link from being carried out if the SHIFT key is down.
<head>
<title>Cancels Links</title>
<script language="JScript">
function cancelLink ( ) {
if ( window.event.srcElement.tagName == "A" &&
window.event.shiftKey )
window.event.returnValue = false;
}
</script>
<head>
<body onclick="cancelLink ( )">
...
</body>
The following example displays the current mouse position in the browser's status window.
<body onmousemove="window.status =
'X=' + window.event.x + ' Y=' + window.event.y">
window