event.initMouseEvent

« DOM Reference

Summary

Intializes the value of a mouse event once it's been created (normally using document.createEvent method).

Syntax

  event.initMouseEvent(type, canBubble, cancelable, view,

                       detail, screenX, screenY, clientX, clientY,

                       ctrlKey, altKey, shiftKey, metaKey,

                       button, relatedTarget);
type
the string to set the event's type to. Possible types for mouse events include: click, mousedown, mouseup, mouseover, mousemove, mouseout.
canBubble
whether or not the event can bubble. Sets the value of event.bubbles.
cancelable
whether or not the event's default action can be prevented. Sets the value of event.cancelable.
view
the Event's AbstractView. You should pass the window object here. Sets the value of event.view.
detail
the Event's mouse click count. Sets the value of event.detail.
screenX
the Event's screen x coordinate. Sets the value of event.screenX.
screenY
the Event's screen y coordinate. Sets the value of event.screenY.
clientX
the Event's client x coordinate. Sets the value of event.clientX.
clientY
the Event's client y coordinate. Sets the value of event.clientY.
ctrlKey
whether or not control key was depressed during the Event. Sets the value of event.ctrlKey.
altKey
whether or not alt key was depressed during the Event. Sets the value of event.altKey.
shiftKey
whether or not shift key was depressed during the Event. Sets the value of event.shiftKey.
metaKey
whether or not meta key was depressed during the Event. Sets the value of event.metaKey.
button
the Event's mouse event.button.
relatedTarget
the Event's related EventTarget. Only used with some event types (e.g. mouseover and mouseout). In other cases, pass null.

Example

Click here for example

Specification

DOM Level 2 Events: initMouseEvent

See Also

event.initEvent is a simpler method serving a similar purpose.

Document Tags and Contributors

Last updated by: miket,