Package | dom.events |
Class | public class UIEvent |
Inheritance | UIEvent Event Object |
Subclasses | KeyboardEvent, KeyEvent, MouseEvent, TextEvent |
Introduced in: | DOM 2 Events |
Modified in: | DOM 3 Events |
To create an instance of the UIEvent interface, use the DocumentEvent.createEvent("UIEvent") method call.
See also
Property | Defined By | ||
---|---|---|---|
DOM 2 Events bubbles : Boolean [read-only]
Used to indicate whether or not an event is a bubbling event. | Event | ||
DOM 2 Events cancelable : Boolean [read-only]
Indicates whether the event is cancelable or not. | Event | ||
DOM 2 Events currentTarget : EventTarget [read-only]
Identifies the current target for the event, as the event traverses the DOM. | Event | ||
DOM 3 Events defaulPrevented : Boolean [read-only]
Used to indicate whether Event.preventDefault() has been called for
this event. | Event | ||
DOM 2 Events detail : Number [read-only]
Specifies some detail information about the Event, depending
on the type of event. | UIEvent | ||
DOM 2 Events eventPhase : Number [read-only]
Used to indicate which phase of event flow is currently being accomplished. | Event | ||
Non-Standard explicitOriginalTarget : nsIDOMEventTarget [read-only]
The explicit original target of the event. | Event | ||
Non-Standard isChar : Boolean [read-only]
Returns a boolean indicating whether the event produced a key character or not. | UIEvent | ||
Non-Standard isTrusted : Boolean [read-only]
Determines if the event was from the user or script generated. | Event | ||
Non-Standard layerX : Number [read-only]
Returns the horizontal coordinate of the event relative to the current layer. | UIEvent | ||
Non-Standard layerY : Number [read-only]
Returns the vertical coordinate of the event relative to the current layer. | UIEvent | ||
DOM 3 Events namespaceURI : DOMString [read-only]
The namespace URI associated with this event at initialization time, or
null if it is unspecified. | Event | ||
Non-Standard originalTarget : * [read-only]
The original target of the event before any retargetings. | Event | ||
Non-Standard pageX : Number [read-only]
Returns the horizontal coordinate of the event relative to whole document. | UIEvent | ||
Non-Standard pageY : Number [read-only]
Returns the vertical coordinate of the event relative to the whole document. | UIEvent | ||
DOM 2 Events target : EventTarget [read-only]
Used to indicate the event target. | Event | ||
DOM 2 Events timeStamp : DOMTimeStamp [read-only]
Used to specify the time at which the event was created in milliseconds
relative to 1970-01-01T00:00:00Z. | Event | ||
DOM 2 Events type : DOMString [read-only]
The local name of the event type. | Event | ||
DOM 2 Events view : AbstractView [read-only]
Returns the AbstractView object from which the event was generated. | UIEvent | ||
Non-Standard which : DOMString [read-only]
Returns the numeric keyCode of the key pressed, or the character code (charCode) for
an alphanumeric key pressed. | UIEvent |
Method | Defined By | ||
---|---|---|---|
Initializes attributes of an Event created through the
DocumentEvent.createEvent method. | Event | ||
DOM 3 Events initEventNS(namespaceURIArg:DOMString, typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean):void
Initializes attributes of an Event object. | Event | ||
DOM 2 Events initUIEvent(typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, viewArg:AbstractView, detailArg:Number):void
Initializes attributes of an UIEvent object. | UIEvent | ||
DOM 3 Events initUIEventNS(namespaceURIArg:DOMString, typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, viewArg:AbstractView, detailArg:Number):void
Initializes attributes of an UIEvent object. | UIEvent | ||
Obsolete preventBubble():void
Prevents the event from bubbling. | Event | ||
Obsolete preventCapture():void
This method is deprecated in favor of standard stopPropagation and is removed in Gecko 1.9. | Event | ||
DOM 2 Events preventDefault():void
Cancels the event if it is cancelable, without stopping further propagation of the event. | Event | ||
DOM 3 Events stopImmediatePropogation():void
Prevents other event listeners from being triggered and, unlike
Event.stopPropagation() its effect is immediate . | Event | ||
DOM 2 Events stopPropogation():void
Prevents other event listeners from being triggered but its effect is
deferred until all event listeners attached on the Event.currentTarget
have been triggered . | Event |
Constant | Defined By | ||
---|---|---|---|
HTML 4.0 abort : String = abort [static]
Loading of a resource has been aborted. | UIEvent | ||
DOM 2 Events AT_TARGET : Number = 2 [static]
The current event is in the target phase, i.e. | Event | ||
DOM 2 Events blur : String = blur [static]
An event target loses focus. | UIEvent | ||
DOM 2 Events BUBBLING_PHASE : Number = 3 [static]
The current event phase is the bubbling phase. | Event | ||
DOM 2 Events CAPTURING_PHASE : Number = 1 [static]
The current event phase is the capture phase. | Event | ||
HTML 4.0 change : String = change [static]
A control loses the input focus and its value has been modified since gaining focus. | UIEvent | ||
DOM 2 Events DOMActivate : String = DOMActivate [static]
Refer to Activation requests and behavior. | UIEvent | ||
DOM 2 Events DOMFocusIn : String = DOMFocusIn [static]
An event target receives focus. | UIEvent | ||
DOM 2 Events DOMFocusOut : String = DOMFocusOut [static]
An event target loses focus. | UIEvent | ||
HTML 4.0 error : String = error [static]
A resource failed to load, or has been loaded but cannot be interpreted according to its semantics
such as an invalid image, a script execution error, or non-well-formed XML. | UIEvent | ||
DOM 2 Events focus : String = focus [static]
An event target receives focus. | UIEvent | ||
HTML 4.0 load : String = load [static]
The DOM Implementation finishes loading the resource (such as the document) and any dependent resources
(such as images, style sheets, or scripts). | UIEvent | ||
HTML 4.0 reset : String = reset [static]
A form, such as a [HTML 4.01] or [XHTML 1.0] form, is reset. | UIEvent | ||
DOM 2 Events resize : String = resize [static]
A document view or an element has been resized. | UIEvent | ||
DOM 2 Events scroll : String = scroll [static]
A document view or an element has been scrolled. | UIEvent | ||
HTML 4.0 select : String = select [static]
A user selects some text. | UIEvent | ||
HTML 4.0 submit : String = submit [static]
A form, such as a [HTML 4.01] or [XHTML 1.0] form, is submitted. | UIEvent | ||
HTML 4.0 unload : String = unload [static]
The DOM implementation removes from the environment the resource (such as the document) or any dependent
resources (such as images, style sheets, scripts). | UIEvent |
DOM 2 Events detail | property |
detail:Number
[read-only] Introduced in: | DOM 2 Events |
Specifies some detail information about the Event, depending on the type of event.
Note: For mouse events, such as click, dblclick, mousedown, or mouseup, the detail property indicates how many times the mouse has been clicked in the same location for this event.
Note: For a dblclick event the value of detail is always 2.
public function get detail():Number
See also
<html> <head> <title>event.detail example</title> <script type="text/javascript"> function giveDetails(e) { var text = document.getElementById("t"); text.value = e.detail; } function init() { var b1 = document.getElementById("b"); b1.onclick = giveDetails; } </script> </head> <body onload="init();"> <form> <input id="b" type="button" value="details"> <input id="t" type="text" value=""><br> <input type="reset"> </form> </body> </html>
isChar | property |
isChar:Boolean
[read-only] Non-standard (Mozilla)
Returns a boolean indicating whether the event produced a key character or not.
Note: Some key combos may raise events but not produce any character (example: ctrl + alt ?). When this is the case, isChar returns false. isChar is used when event handlers need to do something like echo the input on the screen.
Note: There is currently a known bug affecting the return result, which is always false and never true. Please see the discussion link in the sidebar for more details.
public function get isChar():Boolean
See also
if e.isChar { echoInput(e.type); }
layerX | property |
layerX:Number
[read-only] Non-standard (Mozilla)
Returns the horizontal coordinate of the event relative to the current layer.
Note: layerX takes scrolling of the page into account, and returns a value relative to the whole of the document, unless the event occurs inside a positioned element, where the returned value is relative to the top left of the positioned element.
public function get layerX():Number
See also
<html> <head> <title>pageX\pageY & layerX\layerY example</title> <script type="text/javascript"> function showCoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentNode.id; form.parentId.value = parent_id; form.pageXCoords.value = evt.pageX; form.pageYCoords.value = evt.pageY; form.layerXCoords.value = evt.layerX; form.layerYCoords.value = evt.layerY; } </script> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showCoords(event)"> <p>To display the mouse coordinates please click anywhere on the page.</p> <div id="d1"> <span>This is an un-positioned div so clicking it will return layerX/layerY values almost the same as pageX/PageY values.</span> </div> <div id="d2"> <span>This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> <span>Make the page scroll more! This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> </div> <div id="d3"> <form name="form_coords" id="form1"> Parent Element id: <input type="text" name="parentId" size="7" /><br /> pageX:<input type="text" name="pageXCoords" size="7" /> pageY:<input type="text" name="pageYCoords" size="7" /><br /> layerX:<input type="text" name="layerXCoords" size="7" /> layerY:<input type="text" name="layerYCoords" size="7" /> </form> </div> </body> </html>
layerY | property |
layerY:Number
[read-only] Non-standard (Mozilla)
Returns the vertical coordinate of the event relative to the current layer.
Note: layerY takes scrolling of the page into account, and returns a value relative to the whole of the document, unless the event occurs inside a positioned element, where the returned value is relative to the top left of the positioned element.
public function get layerY():Number
See also
<html> <head> <title>pageX\pageY & layerX\layerY example</title> <script type="text/javascript"> function showCoords(evt){ var form = document.forms.form_coords; var parent_id = evt.target.parentNode.id; form.parentId.value = parent_id; form.pageXCoords.value = evt.pageX; form.pageYCoords.value = evt.pageY; form.layerXCoords.value = evt.layerX; form.layerYCoords.value = evt.layerY; } </script> <style type="text/css"> #d1 { border: solid blue 1px; padding: 20px; } #d2 { position: absolute; top: 180px; left: 80%; right:auto; width: 40%; border: solid blue 1px; padding: 20px; } #d3 { position: absolute; top: 240px; left: 20%; width: 50%; border: solid blue 1px; padding: 10px; } </style> </head> <body onmousedown="showCoords(event)"> <p>To display the mouse coordinates please click anywhere on the page.</p> <div id="d1"> <span>This is an un-positioned div so clicking it will return layerX/layerY values almost the same as pageX/PageY values.</span> </div> <div id="d2"> <span>This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> <span>Make the page scroll more! This is a positioned div so clicking it will return layerX/layerY values that are relative to the top-left corner of this positioned element. Note the pageX\pageY properties still return the absolute position in the document, including page scrolling.</span> </div> <div id="d3"> <form name="form_coords" id="form1"> Parent Element id: <input type="text" name="parentId" size="7" /><br /> pageX:<input type="text" name="pageXCoords" size="7" /> pageY:<input type="text" name="pageYCoords" size="7" /><br /> layerX:<input type="text" name="layerXCoords" size="7" /> layerY:<input type="text" name="layerYCoords" size="7" /> </form> </div> </body> </html>
pageX | property |
pageX:Number
[read-only] Non-standard (Mozilla)
Returns the horizontal coordinate of the event relative to whole document.
public function get pageX():Number
See also
pageY | property |
pageY:Number
[read-only] Non-standard (Mozilla)
Returns the vertical coordinate of the event relative to the whole document.
public function get pageY():Number
See also
DOM 2 Events view | property |
view:AbstractView
[read-only] Introduced in: | DOM 2 Events |
Returns the AbstractView object from which the event was generated. In browsers, this is the window object the event happened in.
public function get view():AbstractView
See also
which | property |
which:DOMString
[read-only] Non-standard (Mozilla)
Returns the numeric keyCode of the key pressed, or the character code (charCode) for an alphanumeric key pressed.
public function get which():DOMString
See also
<html> <head> <title>charCode/keyCode/which example</title> <script type="text/javascript"> function showKeyPress(evt) { alert("onkeypress handler: \n" + "keyCode property: " + evt.keyCode + "\n" + "which property: " + evt.which + "\n" + "charCode property: " + evt.charCode + "\n" + "Character Key Pressed: " + String.fromCharCode(evt.charCode) + "\n" ); } function keyDown(evt) { alert("onkeydown handler: \n" + "keyCode property: " + evt.keyCode + "\n" + "which property: " + evt.which + "\n" ); } </script> </head> <body onkeypress="showKeyPress(event);" onkeydown="keyDown(event);" > <p>Please press any key.</p> </body> </html>
DOM 2 Events initUIEvent | () | method |
public function initUIEvent(typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, viewArg:AbstractView, detailArg:Number):void
Introduced in: | DOM 2 Events |
Initializes attributes of an UIEvent object. This method has the same behavior as Event.initEvent().
Parameters
typeArg:DOMString — Specifies Event.type, the local name of the event type.
| |
canBubbleArg:Boolean — Specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event.
| |
cancelableArg:Boolean — Specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event.
| |
viewArg:AbstractView — Specifies UIEvent.view. This value may be null.
| |
detailArg:Number — Specifies UIEvent.detail.
|
See also
e = document.createEvent("UIEvents"); // creates a click event that bubbles, can be cancelled, // and with its view and detail property initialized to window and 1, // respectively e.initUIEvent("click", true, true, window, 1);
DOM 3 Events initUIEventNS | () | method |
public function initUIEventNS(namespaceURIArg:DOMString, typeArg:DOMString, canBubbleArg:Boolean, cancelableArg:Boolean, viewArg:AbstractView, detailArg:Number):void
Introduced in: | DOM 3 Events |
Initializes attributes of an UIEvent object. This method has the same behavior as Event.initEventNS().
Parameters
namespaceURIArg:DOMString — Specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace.
| |
typeArg:DOMString — Specifies Event.type, the local name of the event type.
| |
canBubbleArg:Boolean — Specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event.
| |
cancelableArg:Boolean — Specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event.
| |
viewArg:AbstractView — Specifies UIEvent.view. This value may be null.
| |
detailArg:Number — Specifies UIEvent.detail.
|
See also
HTML 4.0 abort | Constant |
public static const abort:String = abort
Introduced in: | HTML 4.0 |
Modified in: | DOM 3 Events |
Loading of a resource has been aborted.
Note: Dispatched from UIEvent if generated from a user interface, Event otherwise.
Title | Value |
---|---|
Cancelable | No |
Bubbles | Yes |
Target | Element |
Context info | UIEvent.view is in use. |
See also
DOM 2 Events blur | Constant |
public static const blur:String = blur
Introduced in: | DOM 2 Events |
An event target loses focus. The focus is taken from the element before the dispatch of this event type.
Title | Value |
---|---|
Cancelable | No |
Bubbles | No |
Target | Element |
Context info | UIEvent.view is in use. |
See also
HTML 4.0 change | Constant |
public static const change:String = change
Introduced in: | HTML 4.0 |
Modified in: | DOM 3 Events |
A control loses the input focus and its value has been modified since gaining focus. This event type is dispatched before the event type blur.
Note: Dispatched from UIEvent if generated from a user interface, Event otherwise.
Title | Value |
---|---|
Cancelable | No |
Bubbles | Yes |
Target | Element |
Context info | UIEvent.view is in use. |
See also
DOM 2 Events DOMActivate | Constant |
public static const DOMActivate:String = DOMActivate
Introduced in: | DOM 2 Events |
Refer to Activation requests and behavior.
Title | Value |
---|---|
Namespace | None |
Cancelable | Yes |
Bubbles | Yes |
Target | Element |
Context info | UIEvent.view is in use. |
See also
DOM 2 Events DOMFocusIn | Constant |
public static const DOMFocusIn:String = DOMFocusIn
Introduced in: | DOM 2 Events |
An event target receives focus. The focus is given to the element before the dispatch of this event type. This event type is dispatched after the event type focus.
Title | Value |
---|---|
Cancelable | No |
Bubbles | Yes |
Target | Element |
Context info | UIEvent.view is in use. |
See also
DOM 2 Events DOMFocusOut | Constant |
public static const DOMFocusOut:String = DOMFocusOut
Introduced in: | DOM 2 Events |
An event target loses focus. The focus is taken from the element before the dispatch of this event type. This event type is dispatched after the event type blur.
Title | Value |
---|---|
Cancelable | No |
Bubbles | Yes |
Target | Element |
Context info | UIEvent.view is in use. |
See also
HTML 4.0 error | Constant |
public static const error:String = error
Introduced in: | HTML 4.0 |
Modified in: | DOM 3 Events |
A resource failed to load, or has been loaded but cannot be interpreted according to its semantics such as an invalid image, a script execution error, or non-well-formed XML.
Note: Dispatched from UIEvent if generated from a user interface, Event otherwise.
Title | Value |
---|---|
Cancelable | No |
Bubbles | Yes |
Target | Element |
Context info | UIEvent.view is in use. |
See also
DOM 2 Events focus | Constant |
public static const focus:String = focus
Introduced in: | DOM 2 Events |
An event target receives focus. The focus is given to the element before the dispatch of this event type.
Title | Value |
---|---|
Cancelable | No |
Bubbles | No |
Target | Element |
Context info | UIEvent.view is in use. |
See also
HTML 4.0 load | Constant |
public static const load:String = load
Introduced in: | HTML 4.0 |
Modified in: | DOM 3 Events |
The DOM Implementation finishes loading the resource (such as the document) and any dependent resources (such as images, style sheets, or scripts). Dependent resources that fail to load will not prevent this event from firing if the resource that loaded them is still accessible via the DOM. If this event type is dispatched, implementations are required to dispatch this event at least on the Document node.
Note: Dispatched from UIEvent if generated from a user interface, Event otherwise.
Title | Value |
---|---|
Cancelable | No |
Bubbles | No |
Target | Document, Element |
Context info | UIEvent.view is in use. |
See also
HTML 4.0 reset | Constant |
public static const reset:String = reset
Introduced in: | HTML 4.0 |
Modified in: | DOM 3 Events |
A form, such as a [HTML 4.01] or [XHTML 1.0] form, is reset.
Note: Dispatched from UIEvent if generated from a user interface, Event otherwise.
Title | Value |
---|---|
Cancelable | Yes |
Bubbles | Yes |
Target | Element |
Context info | UIEvent.view is in use. |
See also
DOM 2 Events resize | Constant |
public static const resize:String = resize
Introduced in: | DOM 2 Events |
A document view or an element has been resized. The resize occured before the dispatch of this event type.
Title | Value |
---|---|
Cancelable | No |
Bubbles | Yes |
Target | Document, Element |
Context info | UIEvent.view is in use. |
See also
DOM 2 Events scroll | Constant |
public static const scroll:String = scroll
Introduced in: | DOM 2 Events |
A document view or an element has been scrolled. The scroll occured before the dispatch of this event type.
Title | Value |
---|---|
Cancelable | No |
Bubbles | Yes |
Target | Document, Element |
Context info | UIEvent.view is in use. |
See also
HTML 4.0 select | Constant |
public static const select:String = select
Introduced in: | HTML 4.0 |
Modified in: | DOM 3 Events |
A user selects some text. DOM Level 3 Events does not provide contextual information to access the selected text. The selection occured before the dispatch of this event type.
Note: Dispatched from UIEvent if generated from a user interface, Event otherwise.
Title | Value |
---|---|
Cancelable | No |
Bubbles | Yes |
Target | Element |
Context info | UIEvent.view is in use. |
See also
HTML 4.0 submit | Constant |
public static const submit:String = submit
Introduced in: | HTML 4.0 |
Modified in: | DOM 3 Events |
A form, such as a [HTML 4.01] or [XHTML 1.0] form, is submitted.
Note: Dispatched from UIEvent if generated from a user interface, Event otherwise.
Title | Value |
---|---|
Cancelable | Yes |
Bubbles | Yes |
Target | Element |
Context info | UIEvent.view is in use. |
See also
HTML 4.0 unload | Constant |
public static const unload:String = unload
Introduced in: | HTML 4.0 |
Modified in: | DOM 3 Events |
The DOM implementation removes from the environment the resource (such as the document) or any dependent resources (such as images, style sheets, scripts). The document is unloaded after the dispatch of this event type. If this event type is dispatched, implementations are required to dispatch this event at least on the Document node.
Note: Dispatched from UIEvent if generated from a user interface, Event otherwise.
Title | Value |
---|---|
Cancelable | No |
Bubbles | No |
Target | Document, Element |
Context info | UIEvent.view is in use. |
See also