MouseEvent.initMouseEvent() (Method)

After creating a MouseEvent object, it must be initialised with this method call.

Availability:

DOM level - 2
JavaScript - 1.5
Netscape - 6.0
JavaScript syntax:NmyMouseEvent.initMouseEvent(aType, aBubble, aCancel, aView, aDetail, aScrnX, aScrnY, aClntX, aClntY, aCtrl, anAlt, aShift, aMeta, aButton, aRelTarg)
Argument list:aTypeA string value describing the event type
aBubbleA boolean flag indicating whether the event can bubble
aCancelA boolean flag indicating whether the event can be cancelled
aViewA reference to an AbstractView object
aDetailA value describing the event detail
aScrnXA screen X coordinate value
aScrnYA screen Y coordinate value
aClntXA client X coordinate value
aClntYA client Y coordinate value
aCtrlA boolean value indicating the state of the control key
anAltA boolean value indicating the state of the alt key
aShiftA boolean value indicating the state of the shift key
aMetaA boolean value indicating the state of the meta key
aButtonA numeric value indicating which button is being emulated
aRelTargA reference to an EventTarget object

A new event object is manufactured by calling the DocumentEvent.createEvent() method. That event should have been defined with a type specified as "MouseEvent". If it was, then it will support an initMouseEvent() method. This must be called before the event is dispatched otherwise the event object will not contain enough information for the event dispatcher/handler to make sense of it and route it to the correct target objects.

Two boolean argument values define whether the event will be allowed to be cancelled and what type of propagation to use (bubble or capture).

The view argument refers to an AbstractView object which DOM level 2 describes and which may not yet be well supported by any browser.

The detail value can be used to pass context information into the event handling chain.

The screen and client coordinate values are measured in pixels and must be specified as numeric values.

Five boolean values then define the state of keyboard keys when the event was assumed to be triggered.

Finally a reference to a related target object is passed.

See also:AbstractView object, EventTarget object, UIEvent.initUIEvent()