This page is Almost Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

initMouseEvent

Summary

Initializes a new mouse event that the createEvent method created.

Method of dom/MouseEventdom/MouseEvent

Syntax

 event.initMouseEvent(eventType, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);

Parameters

eventType

Data-type
String

The name of the event. Sets the value for the type property.

canBubble

Data-type
Boolean

Whether the event propagates upward. Sets the value for the bubbles property.

cancelable

Data-type
Boolean

Whether the event is cancelable and so preventDefault can be called. Sets the value for the cancelable property.

view

Data-type
DOM Node

The window on which this event is occurring. Sets the value for the view property.

detail

Data-type
Number

Specifies additional information. This value is returned in the detail property of the event.

screenX

Data-type
Number

The x-coordinate of the mouse pointer, relative to the upper-left corner of the screen. Sets the value for the screenX property,

screenY

Data-type
Number

The y-coordinate of the mouse pointer, relative to the upper-left corner of the screen. Sets the value for the screenY property.

clientX

Data-type
Number

The x-coordinate of the mouse pointer, relative to the upper-left corner of the browser’s client area. Sets the value for the clientX property.

clientY

Data-type
Number

The y-coordinate of the mouse pointer, relative to the upper-left corner of the browser’s client area. Sets the value for the clientY property.

ctrlKey

Data-type
Boolean

Whether the Control key is depressed. Sets the value for the ctrlKey property.

altKey

Data-type
Boolean

Whether the Alt key is depressed. Sets the value for the altKey property.

shiftKey

Data-type
Boolean

Whether the Shift key is depressed. Sets the value for the shiftKey property.

metaKey

Data-type
Boolean

Whether a meta key is depressed. Sets the value for the metaKey property.

button

Data-type
Number

The mouse button that caused the event. Sets the value for the button property (see the property page for common values).

relatedTarget

Data-type
DOM Node

A secondary element that is involved in the event. Sets the value for the relatedTarget property.

Return Value

No return value

Related specifications

DOM Level 3 Events
Working Draft

Attributions