Event : Object

Provides information about an event.

Browser/User Agent Support

IEMozillaNetscapeOperaSafariNetscapte
4.0+1.0+4.0+7.0+1.0+no

Constructors

ConstructorIEMozillaNetscapeOperaSafariNetscapte
Provides information about an event.
4.0+1.0+4.0+7.0+1.0+no
 

Properties

PropertyIEMozillaNetscapeOperaSafariNetscapte
Specifies the Abstract content of the entry banner for an ASX file.
6.0+nonononono
 
If true, the ALT key is currently being pressed.
6.0+1.75+nono1.2+no
 
If true, the left ALT key is currently being pressed.
6.0+nonononono
 
Specifies the Banner content of the entry for an ASX file.
6.0+nonononono
 
Specify true if the event type bubbles. Otherwise, false.
no1.0+4.0+7.0+1.0+no
 
Specifies the mouse button that was clicked. Valid values are 0 = No button pressed. 1 = Left button pressed. 2 = Right button pressed. 3 = Left and right buttons both pressed. 4 = Middle button pressed. 5 = Left and middle buttons pressed. 6 = Right and middle buttons are both pressed. 7 = All three buttons pressed.
5.0+nonononono
 
True if the action of the event can be cancelled with the preventDefault()method. Otherwise, false.
no1.0+4.0+7.0+1.0+no
 
If true, bubbling is disabled for the event.
5.0+nonononono
 
Specifies the x-coordinate (in pixels) of the mouse relative to the client window.
4.0+1.75no8.0+1.2no
  • Safari: Gives position relative to the document.
Specifies the y-coordinate (in pixels) of the mouse relative to the client window.
4.0+1.75no8.0+1.2no
  • Safari: Gives position relative to the document.
If true, overflow content should be formatted using a new LayoutRect object.
6.0+nonononono
 
If true, the CTRL key is currently being pressed.
5.0+1.75no8.0+1.2no
 
If true, the left CTRL key is currently being pressed.
6.0+nonononono
 
Node of the Document that is handling the event.
no1.0+4.0+7.0+1.0+no
 
Specifies the data column in the current recordset.
6.0+nonononono
 
Phase that the event is currently in. See Remarks for a list of valid values.
no1.0+4.0+7.0+1.0+no
 
Specifies the element that was the previous location of the pointer or cursor.
5.0+nono8.0+1.2+no
 
Specifies the Unicode key code for the event..
6.0+1.75+no8.0+1.2+no
 
Specifies the MoreInfo content of the entry banner for an ASX file.
6.0+nonononono
 
Specifies position of the next page for printing. Valid values are
6.0+nonononono
 
Specifies position of the next page for printing. Valid values are "left", "right", and "".
6.0+nonononono
 
Specifies the x-coordinate (in pixels) of the mouse relative to the object that is firing the event.
5.0+nono8.0+1.2+no
 
Specifies the y-coordinate (in pixels) of the mouse relative to the object that is firing the event.
5.0+nono8.0+1.2+no
 
Specifies the name of the property whose value changes.
5.0+nonononono
 
Specifies the name of the data member from the data source.
5.0+nonononono
 
Specifies the result of a data transfer for a data source. Valid values are 0 = success, 1 = transfer aborted, 2 = error.
5.0+nonononono
 
Specifies the result of a data transfer for a data source. Valid values are 0 = success, 1 = transfer aborted, 2 = error.
5.0+nonononono
 
If true, specifies that the onkeydown event was repeated.
6.0+nonononono
 
If true, the value from the event is returned.
6.0+nonononono
 
Specifies either "TEXT" or "HTML" as the clipboard type when the oncontentsave event fires.
6.0+nonononono
 
Specifies the x-coordinate (in pixels) of the mouse relative to the screen.
5.0+1.75+no8.0+1.2+no
 
Specifies the y-coordinate (in pixels) of the mouse relative to the screen.
5.0+1.75+no8.0+1.2+no
 
If true, the SHIFT key is currently being pressed.
5.0+1.75+no8.0+1.2+no
 
If true, the left SHIFT key is currently being pressed.
6.0+nonononono
 
Element that fired or received the event.
5.0+nono8.0+1.2+no
  • IE: Partial support.
Object that caused the onfilterchange event to fire.
5.0+nonononono
 
Specifies the URN for the behavior that fired the event.
5.0+nonononono
 
Target node for the event.
no1.0+4.0+7.0+1.0+no
 
Date and time that the event occurred.
no1.75+nono1.2+no
  • Mozilla: Does not work on a "click" event.
Specifies the element that the mouse pointer is moving toward.
5.0+nono8.0+1.2+no
 
Type of event.
4.0+1.0+4.0+7.0+1.0+no
 
Specifies the sFriendlyName parameter for the useService method.
6.0+nonononono
 
Specifies distance and direction that the mouse wheel has scrolled.
6.0+nonononono
 
Specifies the x-coordinate (in pixels) of the mouse relative to the parent element.
5.0+nonono1.34.0
  • IE: Equivalent to "clientX" on Mac.
  • Safari: Equivalent to "clientX".
  • Netscapte: Equivalent to "layerX".
Specifies the y-coordinate (in pixels) of the mouse relative to the parent element.
5.0+nonono1.34.0
  • IE: Equivalent to "clientY" on Mac.
  • Safari: Equivalent to "clientY".
  • Netscapte: Equivalent to "layerY".

Methods

MethodIEMozillaNetscapeOperaSafariNetscapte
Initializes the properties of an Event.
no1.0+4.0+7.0+1.0+no
 
Prevents the default action for the event.
no1.0+4.0+7.0+1.0+no
 
Stops the propagation of an event.
no1.0+4.0+7.0+1.0+no
 

Remarks

Whenever some event occurs with the DOM, different event handlers are given the choice of intercepting and doing something with it. The Event object is used to provide context that each event handler can use to get information about the event, like the originating element, what stage the event is currently in within the event system, and so forth.

More specific events, that provide additional context information based on the type of event. For instance, the MouseEvent object, which inherits from Event, supplies additional properties supplying information such as the MouseEvent.button, MouseEvent.screenX and MouseEvent.screenY for where the current mouse event took place.

Due to this, the properties and methods supported by the Event object are rather minimal, and supply the basic set of functionality required for all types of events.

References

EventListener | EventTarget | MouseEvent | UIEvent

Availability

HTML DOM Level 2 | W3C

Constructor Detail

Event Event()

Provides information about an event.

Visibility
internal

Property Detail

String Abstract - read only

Specifies the Abstract content of the entry banner for an ASX file.

Boolean altKey - read only

If true, the ALT key is currently being pressed.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/keys.html

Boolean altLeft - read only

If true, the left ALT key is currently being pressed.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/keys.html

String Banner - read only

Specifies the Banner content of the entry for an ASX file.

Boolean bubbles - read only

Specify true if the event type bubbles. Otherwise, false.

Remarks
A bubbling event will continue unless stopPropagation() is called on the event.
Availability

HTML DOM Level 2 | W3C

Number button

Specifies the mouse button that was clicked. Valid values are 0 = No button pressed. 1 = Left button pressed. 2 = Right button pressed. 3 = Left and right buttons both pressed. 4 = Middle button pressed. 5 = Left and middle buttons pressed. 6 = Right and middle buttons are both pressed. 7 = All three buttons pressed.

Boolean cancelable - read only

True if the action of the event can be cancelled with the preventDefault()method. Otherwise, false.

Availability

HTML DOM Level 2 | W3C

Boolean cancelBubble

If true, bubbling is disabled for the event.

Number clientX

Specifies the x-coordinate (in pixels) of the mouse relative to the client window.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/mouseposition.html

Number clientY

Specifies the y-coordinate (in pixels) of the mouse relative to the client window.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/mouseposition.html

Boolean contentOverflow - read only

If true, overflow content should be formatted using a new LayoutRect object.

Boolean ctrlKey - read only

If true, the CTRL key is currently being pressed.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/keys.html

Boolean ctrlLeft - read only

If true, the left CTRL key is currently being pressed.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/keys.html

EventTarget currentTarget - read only

Node of the Document that is handling the event.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/targets.html

Remarks
During the capturing and bubbling phases of event processing, the Event object will be passed around to various EventListeners. The value of this property will point to the EventTargetNode within the DOM where this Event is currently being evaluated.
Availability

HTML DOM Level 2 | W3C

String dataFld

Specifies the data column in the current recordset.

Number eventPhase - read only

Phase that the event is currently in. See Remarks for a list of valid values.

Remarks

The following constants are valid values for eventPhase:

  • CAPTURING_PHASE = 1 - Indicates that the event is in the capturing phase.
  • AT_TARGET = 2 - Indicates that the event is being handled by its target node.
  • BUBBLING_PHASE = 3 - Indicates that the event is bubbling.
Availability

HTML DOM Level 2 | W3C

Element fromElement

Specifies the element that was the previous location of the pointer or cursor.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/targets.html

Number keyCode

Specifies the Unicode key code for the event..

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/keys.html

Number MoreInfo - read only

Specifies the MoreInfo content of the entry banner for an ASX file.

String nextPage - read only

Specifies position of the next page for printing. Valid values are

String nextPage - read only

Specifies position of the next page for printing. Valid values are "left", "right", and "".

Number offsetX

Specifies the x-coordinate (in pixels) of the mouse relative to the object that is firing the event.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/mouseposition.html

Number offsetY

Specifies the y-coordinate (in pixels) of the mouse relative to the object that is firing the event.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/mouseposition.html

String propertyName

Specifies the name of the property whose value changes.

String qualifier

Specifies the name of the data member from the data source.

Number reason - read only

Specifies the result of a data transfer for a data source. Valid values are 0 = success, 1 = transfer aborted, 2 = error.

Number recordSet - read only

Specifies the result of a data transfer for a data source. Valid values are 0 = success, 1 = transfer aborted, 2 = error.

Boolean repeat

If true, specifies that the onkeydown event was repeated.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/keys.html

Boolean returnValue

If true, the value from the event is returned.

String saveType - read only

Specifies either "TEXT" or "HTML" as the clipboard type when the oncontentsave event fires.

Number screenX

Specifies the x-coordinate (in pixels) of the mouse relative to the screen.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/mouseposition.html

Number screenY

Specifies the y-coordinate (in pixels) of the mouse relative to the screen.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/mouseposition.html

Boolean shiftKey - read only

If true, the SHIFT key is currently being pressed.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/keys.html

Boolean shiftLeft - read only

If true, the left SHIFT key is currently being pressed.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/keys.html

Element srcElement

Element that fired or received the event.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/targets.html

Object srcFilter

Object that caused the onfilterchange event to fire.

String srcURN

Specifies the URN for the behavior that fired the event.

EventTarget target - read only

Target node for the event.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/targets.html

Remarks
Tracks the EventTarget that this event originated from. This is a Node that implements the necessary methods to function as a target for DOM events, and can be used as such.
Availability

HTML DOM Level 2 | W3C

Date timeStamp - read only

Date and time that the event occurred.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/timestamp.html

Availability

HTML DOM Level 2 | W3C

Element toElement

Specifies the element that the mouse pointer is moving toward.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/targets.html

String type - read only

Type of event.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/targets.html

Remarks
Not case sensitive.
Availability

HTML DOM Level 2 | W3C

String userName - read only

Specifies the sFriendlyName parameter for the useService method.

Number wheelData - read only

Specifies distance and direction that the mouse wheel has scrolled.

Number x

Specifies the x-coordinate (in pixels) of the mouse relative to the parent element.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/mouseposition.html

Number y

Specifies the y-coordinate (in pixels) of the mouse relative to the parent element.

For examples, see the quirksmode test page:

http://www.quirksmode.org/js/events/mouseposition.html

Method Detail

initEvent(String eventTypeArg, Boolean canBubbleArg, Boolean cancelableArg) : void

Initializes the properties of an Event.

StringeventTypeArgType of event.
BooleancanBubbleArgSpecify "true" if the event will bubble.
BooleancancelableArgSpecify "true" if the preventDefault() method can cancel the event.

Availability

HTML DOM Level 2 | W3C

preventDefault() : void

Prevents the default action for the event.

Remarks
If the cancelable property for the event is set to false, the event either has no default action, or the preventDefault method will not be able to prevent the default action.
Availability

HTML DOM Level 2 | W3C

stopPropagation() : void

Stops the propagation of an event.

Remarks
Prevents the event from being dispatched to other nodes. Does not prevent other event callers from being called on the node.
Availability

HTML DOM Level 2 | W3C