Browse By Name
HTMLCSSJavaScriptAppendix
You are here: Reference > appendix > javascript > interfaces

Interfaces in JavaScript

A A Font size Print Content Add new content Share
An interface allows developers to add new functionalities to objects that implement it. For example, the HTMLAnchorElement interface lets you define new properties and methods on all anchor elements.

In the followings, you can find the interfaces in alphabetical order, the interface inheritance hierarchy, browser support information and the objects that implement them. At the bottom of this page, a few examples demonstrate the use of interfaces.

Note: Internet Explorer supports interfaces from version 8.
Interfaces in alphabetical order:
Interface inheritance hierarchy:
Interface Support Object that implements it in JavaScript
BarProp
BarProp
BoxObject
BoxObject
ClientRect
TextRectangle
ClientRectList
TextRectangles
Counter
Counter
Crypto
crypto
CSSRule
rule
CSSCharsetRule
rule
CSSFontFaceRule
rule
CSSImportRule
rule
CSSMediaRule
rule
CSSPageRule
rule
CSSStyleRule
rule
CSSRuleList
rules
CSSStyleDeclaration
CSSStyleDeclaration, currentStyle, style
ComputedCSSStyleDeclaration
CSSStyleDeclaration
CSSStyleSheet
styleSheet
CSSValue
CSSValue
CSSPrimitiveValue
CSSPrimitiveValue
CSSValueList
CSSValueList
DOMImplementation
implementation
DOMParser
DOMParser
DOMStringList
DOMStringList
Event
event
If you need a summary of events and event types, see the page for Events in JavaScript.
Use the createEvent method with 'Event' type to create and the initEvent method to initialize an event object that implements this interface.
Reference:
Members of the Event interface
Event interface (W3C)
MessageEvent
event
Use the createEvent method with 'MessageEvent' type to create and the initMessageEvent method to initialize an event object that implements this interface.
Reference:
Additional members of the MessageEvent interface
MessageEvent interface (HTML 5)
MutationEvent
event
Use the createEvent method with 'MutationEvent' type to create and the initMutationEvent method to initialize an event object that implements this interface.
Reference:
Additional members of the MutationEvent interface
MutationEvent interface (W3C)
OverflowEvent
event
Use the createEvent method with 'OverflowEvent' type to create and the initOverflowEvent method to initialize an event object that implements this interface.
Reference:
Additional members of the OverflowEvent interface
PopupBlockedEvent
event
Use the createEvent method with 'PopupBlockedEvents' type to create and the initPopupBlockedEvent method to initialize an event object that implements this interface.
ProgressEvent
event
Use the createEvent method with 'ProgressEvent' type to create and the initProgressEvent method to initialize an event object that implements this interface.
Firefox supports the ProgressEvent interface from version 3.5.
StorageEvent
event
Use the createEvent method with 'StorageEvent' type to create and the initStorageEvent method to initialize an event object that implements this interface.
SVGEvent
event
Use the createEvent method with 'SVGEvent' type to create and the initEvent method to initialize an event object that implements this interface.
UIEvent
event
Use the createEvent method with 'UIEvent' type to create and the initUIEvent method to initialize an event object that implements this interface.
Reference:
Additional members of the UIEvent interface
UIEvent interface (W3C)
KeyboardEvent
event
Use the createEvent method with 'KeyboardEvent' type to create and the initKeyEvent method to initialize an event object that implements this interface.
Reference:
Additional members of the KeyboardEvent interface
KeyboardEvent interface (W3C)
MouseEvent
event
Use the createEvent method with 'MouseEvent' type to create and the initMouseEvent method to initialize an event object that implements this interface.
Reference:
Additional members of the MouseEvent interface
MouseEvent interface (W3C)
DragEvent
event
Use the createEvent method with 'DragEvent' type to create and the initDragEvent method to initialize an event object that implements this interface.
Reference:
Additional members of the DragEvent interface
DragEvent interface (HTML5)
SVGZoomEvent
event
Use the createEvent method with 'SVGZoomEvent' type to create and the initUIEvent method to initialize an event object that implements this interface.
TextEvent
event
Use the createEvent method with 'TextEvent' type to create and the initTextEvent method to initialize an event object that implements this interface.
Reference:
Additional members of the TextEvent interface
TextEvent interface (W3C)
WheelEvent
event
Use the createEvent method with 'WheelEvent' type to create and the initUIEvent method to initialize an event object that implements this interface. Reference:
Additional members of the WheelEvent interface
XULCommandEvent
event
Use the createEvent method with 'XULCommandEvent' type to create and the initCommandEvent method to initialize an event object that implements this interface.
GeckoActiveXObject
GeckoActiveXObject
History
history
Image
Image
File
File
FileList
FileList
HTMLCollection
all, anchors, applets, areas, cells, children, elements, embeds, forms, images, links, rows, scripts, tBodies
Note: whether the HTMLCollection interface is supported by Firefox, but the previous collections are not inherited from it.
HTMLOptionsCollection
options
Location
location
MediaList
mediaList
MimeType
mimeType
MimeTypeArray
mimeTypes
NamedNodeMap
attributes
Navigator
navigator
Node
Attr
attribute
CDATASection
CDATASection
Comment
CommentNode
Document
HTMLDocument
document
XMLDocument
XMLDocument
Note: the XMLDocument interface is identical to the Document interface in Safari.
DocumentFragment
DocumentFragment
DocumentType
doctype
Element
HTMLElement
HTMLAnchorElement
a
HTMLAppletElement
applet
HTMLAreaElement
area
HTMLAudioElement
Audio - Firefox supports the HTMLAudioElement interface from version 3.5.
HTMLBaseElement
base
HTMLBaseFontElement
basefont
HTMLBlockquoteElement
blockquote
HTMLBodyElement
body
HTMLBRElement
br
HTMLButtonElement
button
HTMLCanvasElement
Canvas
HTMLTableCaptionElement
caption
HTMLTableColElement
col, colgroup
HTMLDelElement
del
HTMLDirectoryElement
dir
HTMLDivElement
div, marquee, noframes, noscript
HTMLDListElement
dl
HTMLEmbedElement
embed
HTMLFieldSetElement
fieldset
HTMLFontElement
font
HTMLFormElement
form
HTMLFrameElement
frame
HTMLFrameSetElement
frameset
HTMLHeadingElement
h1, h2, h3, h4, h5, h6
HTMLHeadElement
head
HTMLHRElement
hr
HTMLHtmlElement
html
HTMLIFrameElement
iframe
HTMLImageElement
img
HTMLInputElement
input:button, input:checkbox, input:file, input:hidden, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text
HTMLInsElement
ins
HTMLIsIndexElement
isindex
HTMLLabelElement
label
HTMLLegendElement
legend
HTMLLIElement
li
HTMLLinkElement
link
HTMLMapElement
map
HTMLMarqueeElement
marquee
HTMLMediaElement
Media - Firefox supports the HTMLMediaElement interface from version 3.5.
HTMLMenuElement
menu
HTMLMetaElement
meta
HTMLModElement
del, ins
In Firefox, use the HTMLDelElement and HTMLInsElement interfaces instead.
HTMLObjectElement
object
HTMLOListElement
ol
HTMLOptGroupElement
optgroup
HTMLOptionElement
option
HTMLParagraphElement
p
HTMLParamElement
param
HTMLPreElement
pre
HTMLQuoteElement
blockquote, q
HTMLScriptElement
script
HTMLSelectElement
select, keygen
HTMLSpanElement
abbr, acronym, address, b, bdo, big, blink, center, cite, code, dd, dfn, dt, em, i, kbd, listing, nobr, plaintext, s,
samp, small, span, strike, strong, sub, sup, tt, u, var, xmp
HTMLStyleElement
style
HTMLTableElement
table
HTMLTableSectionElement
tbody, tfoot, thead
HTMLTableCellElement
td, th
HTMLTextAreaElement
textarea
HTMLTitleElement
title
HTMLTableRowElement
tr
HTMLUListElement
ul
HTMLUnknownElement
HTMLVideoElement
Video - Firefox supports the HTMLVideoElement interface from version 3.5.
HTMLWBRElement
wbr
Entity
Entity
EntityReference
EntityReference
Text
TextNode
NodeFilter
Constants are defined in the scope of this interface. See the pages for the whatToShow property and the createNodeIterator and createTreeWalker methods for details.
NodeList
NodeList, childNodes
Notation
Notation
Option
Option
Plugin
plugin
PluginArray
plugins
ProcessingInstruction
ProcessingInstruction
Range
Range
Rect
Rect
CSSRect
Rect
RGBColor
RGBColor
CSSRGBColor
RGBColor
Screen
screen
Selection
selectionRange
Storage
Storage
StyleSheetList
styleSheets
TreeWalker
TreeWalker
Window
window
XMLHttpRequest
XMLHttpRequest
XMLSerializer
XMLSerializer
XPathNSResolver
XPathNSResolver
XPathResult
XPathResult

Members of the Event interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Constants:

The following constants are available in the scope of the Event interface (Event.CAPTURING_PHASE, Event.DBLCLICK, etc.). Using the constants instead of their numeric values results in more readable code.
The following constants represent the processing phases of events and can be used for the values of the eventPhase property.
Name Support Description
CAPTURING_PHASE
The event flow is in capturing phase.
AT_TARGET
The event flow is in target phase.
BUBBLING_PHASE
The event flow is in bubbling phase.
The following constants represent event types and some of them can be used for the first parameter of the captureEvents and releaseEvents methods.
Name Support
ABORT
BACK
BLUR
CLICK
CHANGE
DBLCLICK
DRAGDROP
ERROR
FOCUS
FORWARD
HELP
KEYDOWN
KEYPRESS
KEYUP
LOAD
LOCATE
MOUSEDOWN
MOUSEDRAG
MOUSEMOVE
MOUSEOUT
MOUSEOVER
MOUSEUP
MOVE
RESET
RESIZE
SCROLL
SELECT
SUBMIT
UNLOAD
XFER_DONE
The following constants represent the ALT, CTRL, META and SHIFT keys that can be used for the modifiers event property. The modifiers property is deprecated and not supported by Internet Explorer, Firefox, Opera and Safari. Use the altKey, ctrlKey, metaKey and shiftKey properties instead.
Name Support
ALT_MASK
CONTROL_MASK
SHIFT_MASK
META_MASK

Properties:

Name Support Description
altKey
Sets or retrieves a Boolean value that indicates whether the left or right ALT key was down at the time when the event occurred.
altLeft
Sets or retrieves a Boolean value that indicates whether the left ALT key was down at the time when the event occurred.
bookmarks
Represents a collection of ADO bookmarks associated with the rows affected by the current event.
boundElements
Represents a collection of elements bound to the data set on which the current event occurred.
bubbles
Returns a Boolean value that indicates whether the current style can propagate up the DOM hierarchy or not.
button
Sets or retrieves the mouse button(s) that were pressed at the time when the current event was fired.
cancelable
Returns a Boolean value that indicates whether the current event can be canceled or not.
cancelBubble
Sets or retrieves a Boolean value that indicates whether the current style should propagate up the DOM hierarchy, or not.
clientX
Sets or returns the x-coordinate of the mouse pointer relative to the top-left corner of the browser window's client area.
clientY
Sets or returns the y-coordinate of the mouse pointer relative to the top-left corner of the browser window's client area.
ctrlKey
Sets or retrieves whether the left or right CTRL key was down at the time when the event occurred.
ctrlLeft
Sets or retrieves whether the left CTRL key was down at the time when the event occurred.
currentTarget
Returns a reference to the element whose event listener is being processed.
dataFld
Sets or returns the name of the modified data column in case of the oncellchange event.
dataTransfer
Represents a drag-and-drop operation.
eventPhase
Returns an integer value that indicates the current processing phase of an event.
explicitOriginalTarget
Returns a reference to the exact object on which the event originally occurred.
fromElement
Returns a reference to the object that lost the active state or that the mouse pointer left.
isTrusted
Returns a Boolean value that indicates whether the event is a trusted event or not.
keyCode
Sets or retrieves the Unicode character code of the key that generated the onkeypress event and the Unicode key code of the key that generated the onkeydown and onkeyup events.
offsetX
Sets or retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the offsetParent element of the element that fires the event.
offsetY
Sets or retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the offsetParent element of the element that fires the event.
originalTarget
Returns a reference to the object on which the event originally occurred.
propertyName
Specifies or retrieves a string that contains the name of the property that is changed.
qualifier
Sets or retrieves the name of the default data member. Use this property with data binding events (such as ondatasetcomplete).
reason
Sets or retrieves an integer value that indicates whether the data transfer was successful or not. Use this property with ondatasetcomplete events.
recordset
Sets or retrieves a reference to the default record set in a data source.
repeat
Sets or retrieves a Boolean value that indicates whether the onkeydown event is being repeated (a key has been down long enough).
returnValue
Sets or retrieves a Boolean value that indicates whether the current event is canceled.
screenX
Sets or retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the screen.
screenY
Sets or retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the screen.
shiftKey
Sets or retrieves a Boolean value that indicates whether the left or right SHIFT key was down at the time when the event occurred.
shiftLeft
Sets or retrieves a Boolean value that indicates whether the left SHIFT key was down at the time when the event occurred.
srcElement
Retrieves a reference to the object on which the event occurred.
srcFilter
Specifies or retrieves a reference to the filter object that generated the onfilterchange event.
srcUrn
Sets or retrieves the Uniform Resource Identifier (URI) of the behavior that fired the event.
target
Returns a reference to the object on which the event originally occurred.
timeStamp
Returns the time in milliseconds when the current event occurred.
toElement
Returns a reference to the object that the mouse pointer entered.
type
Retrieves a string that represents the type of the event, such as "mouseout", "click", etc.
wheelDelta
Returns an integer value indicating the distance that the mouse wheel rolled.
x
Sets or retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the closest relatively positioned ancestor element of the element that fires the event.
y
Sets or retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the closest relatively positioned ancestor element of the element that fires the event.

Methods:

Name Support Description
initEvent
Initializes an event object created by the createEvent method.
preventDefault
Cancels the current event.
stopPropagation
Disables the propagation of the current event in the DOM hierarchy.

Additional members of the DragEvent interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Properties:

Name Support Description
dataTransfer
Represents a drag-and-drop operation.

Methods:

Name Support Description
initDragEvent
Initializes an event object created by the createEvent method with type of 'DragEvent'.

Additional members of the KeyboardEvent interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Constants:

The following constants are available in the scope of the KeyboardEvent interface (KeyboardEvent.DOM_VK_CANCEL). Using the constants instead of their numeric values results in more readable code.
The following constants represent Unicode key codes that can be used for the values of the keyCode and which properties and for the keyCode parameter of the initKeyEvent method.
Name Support
DOM_VK_CANCEL
DOM_VK_HELP
DOM_VK_BACK_SPACE
DOM_VK_TAB
DOM_VK_CLEAR
DOM_VK_RETURN
DOM_VK_ENTER
DOM_VK_SHIFT
DOM_VK_CONTROL
DOM_VK_ALT
DOM_VK_PAUSE
DOM_VK_CAPS_LOCK
DOM_VK_ESCAPE
DOM_VK_SPACE
DOM_VK_PAGE_UP
DOM_VK_PAGE_DOWN
DOM_VK_END
DOM_VK_HOME
DOM_VK_LEFT
DOM_VK_UP
DOM_VK_RIGHT
DOM_VK_DOWN
DOM_VK_PRINTSCREEN
DOM_VK_INSERT
DOM_VK_DELETE
DOM_VK_0
DOM_VK_1
DOM_VK_2
DOM_VK_3
DOM_VK_4
DOM_VK_5
DOM_VK_6
DOM_VK_7
DOM_VK_8
DOM_VK_9
DOM_VK_SEMICOLON
DOM_VK_EQUALS
DOM_VK_A
DOM_VK_B
DOM_VK_C
DOM_VK_D
DOM_VK_E
DOM_VK_F
DOM_VK_G
DOM_VK_H
DOM_VK_I
DOM_VK_J
DOM_VK_K
DOM_VK_L
DOM_VK_M
DOM_VK_N
DOM_VK_O
DOM_VK_P
DOM_VK_Q
DOM_VK_R
DOM_VK_S
DOM_VK_T
DOM_VK_U
DOM_VK_V
DOM_VK_W
DOM_VK_X
DOM_VK_Y
DOM_VK_Z
DOM_VK_CONTEXT_MENU
DOM_VK_NUMPAD0
DOM_VK_NUMPAD1
DOM_VK_NUMPAD2
DOM_VK_NUMPAD3
DOM_VK_NUMPAD4
DOM_VK_NUMPAD5
DOM_VK_NUMPAD6
DOM_VK_NUMPAD7
DOM_VK_NUMPAD8
DOM_VK_NUMPAD9
DOM_VK_MULTIPLY
DOM_VK_ADD
DOM_VK_SEPARATOR
DOM_VK_SUBTRACT
DOM_VK_DECIMAL
DOM_VK_DIVIDE
DOM_VK_F1
DOM_VK_F2
DOM_VK_F3
DOM_VK_F4
DOM_VK_F5
DOM_VK_F6
DOM_VK_F7
DOM_VK_F8
DOM_VK_F9
DOM_VK_F10
DOM_VK_F11
DOM_VK_F12
DOM_VK_F13
DOM_VK_F14
DOM_VK_F15
DOM_VK_F16
DOM_VK_F17
DOM_VK_F18
DOM_VK_F19
DOM_VK_F20
DOM_VK_F21
DOM_VK_F22
DOM_VK_F23
DOM_VK_F24
DOM_VK_NUM_LOCK
DOM_VK_SCROLL_LOCK
DOM_VK_COMMA
DOM_VK_PERIOD
DOM_VK_SLASH
DOM_VK_BACK_QUOTE
DOM_VK_OPEN_BRACKET
DOM_VK_BACK_SLASH
DOM_VK_CLOSE_BRACKET
DOM_VK_QUOTE
DOM_VK_META

Properties:

Name Support Description
altKey
Sets or retrieves a Boolean value that indicates whether the left or right ALT key was down at the time when the event occurred.
charCode
Retrieves the Unicode character code of the key that generated the onkeypress event.
ctrlKey
Sets or retrieves whether the left or right CTRL key was down at the time when the event occurred.
keyCode
Sets or retrieves the Unicode character code of the key that generated the onkeypress event and the Unicode key code of the key that generated the onkeydown and onkeyup events.
metaKey
Retrieves a Boolean value that indicates whether the META key was down at the time when the event occurred.
shiftKey
Sets or retrieves a Boolean value that indicates whether the left or right SHIFT key was down at the time when the event occurred.

Methods:

Name Support Description
initKeyEvent
Initializes an event object created by the createEvent method with type of 'KeyboardEvent'.

Additional members of the MessageEvent interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Properties:

Name Support Description
data
Returns the characters entered in case of the textInput event or the contents of the message for the onmessage event.
lastEventId
Returns the identifier of the last event in case of onmessage events.
origin
Returns the scheme, hostname and port of the document that caused the onmessage event.
source
Returns a reference to the window object that contains the document that caused the onmessage event.

Methods:

Name Support Description
initMessageEvent
Initializes an event object created by the createEvent method with type of 'MessageEvent'.

Additional members of the MouseEvent interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Properties:

Name Support Description
altKey
Sets or retrieves a Boolean value that indicates whether the left or right ALT key was down at the time when the event occurred.
button
Sets or retrieves the mouse button(s) that were pressed at the time when the current event was fired.
clientX
Sets or returns the x-coordinate of the mouse pointer relative to the top-left corner of the browser window's client area.
clientY
Sets or returns the y-coordinate of the mouse pointer relative to the top-left corner of the browser window's client area.
ctrlKey
Sets or retrieves whether the left or right CTRL key was down at the time when the event occurred.
dataTransfer
Represents a drag-and-drop operation.
fromElement
Returns a reference to the object that lost the active state or that the mouse pointer left.
keyCode
Sets or retrieves the Unicode character code of the key that generated the onkeypress event and the Unicode key code of the key that generated the onkeydown and onkeyup events.
metaKey
Retrieves a Boolean value that indicates whether the META key was down at the time when the event occurred.
offsetX
Sets or retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the offsetParent element of the element that fires the event.
offsetY
Sets or retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the offsetParent element of the element that fires the event.
relatedTarget
Returns a reference to the related element in case of onmouseover, onmouseout, dragenter and dragexit events.
screenX
Sets or retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the screen.
screenY
Sets or retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the screen.
shiftKey
Sets or retrieves a Boolean value that indicates whether the left or right SHIFT key was down at the time when the event occurred.
toElement
Returns a reference to the object that the mouse pointer entered.
x
Sets or retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the closest relatively positioned ancestor element of the element that fires the event.
y
Sets or retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the closest relatively positioned ancestor element of the element that fires the event.

Methods:

Name Support Description
initMouseEvent
Initializes an event object created by the createEvent method with type of 'MouseEvent'.

Additional members of the MutationEvent interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Constants:

The following constants are available in the scope of the MutationEvent interface (MutationEvent.MODIFICATION). Using the constants instead of their numeric values results in more readable code.
The following constants represent actions that can be used for the value of the attrChange property and for the attrChange parameter of the initMutationEvent method.
Name Support Description
MODIFICATION
Modification action occurred.
ADDITION
Addition action occurred.
REMOVAL
Removal action occurred.

Properties:

Name Support Description
attrChange
Returns an integer that specifies the type of the action that modified an attribute.
attrName
Retrieves a string that specifies the name of the modified attribute.
newValue
Retrieves a string that specifies the current value of the modified attribute or TextNode element.
prevValue
Retrieves a string that specifies the previous value of the modified attribute or TextNode element.
relatedNode
Returns a reference to the node on which the mutation event occurred.

Methods:

Name Support Description
initMutationEvent
Initializes an event object created by the createEvent method with type of 'MutationEvent'.

Additional members of the OverflowEvent interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Constants:

The following constants are available in the scope of the OverflowEvent interface (OverflowEvent.HORIZONTAL). Using the constants instead of their numeric values results in more readable code.
The following constants identify scrollbars that can be used for the value of the orient property and for the orient parameter of the initOverflowEvent method.
Name Support Description
HORIZONTAL
Identifies the horizontal scrollbar.
VERTICAL
Identifies the vertical scrollbar.
BOTH
Identifies both the horizontal and vertical scrollbars.

Properties:

Name Support Description
horizontalOverflow
Retrieves a Boolean value that indicates the horizontal overflow state of an element when the overflowchanged event occurred.
orient
Retrieves whether the visibility of the horizontal or vertical scrollbar changed when the overflowchanged event occurred.
verticalOverflow
Retrieves a Boolean value that indicates the vertical overflow state of an element when the overflowchanged event occurred.

Methods:

Name Support Description
initOverflowEvent
Initializes an event object created by the createEvent method with type of 'OverflowEvent'.

Additional members of the TextEvent interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Properties:

Name Support Description
data
Returns the characters entered in case of the textInput event or the contents of the message for the onmessage event.

Methods:

Name Support Description
initTextEvent
Initializes an event object created by the createEvent method with type of 'TextEvent'.

Additional members of the UIEvent interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Properties:

Name Support Description
cancelBubble
Sets or retrieves a Boolean value that indicates whether the current style should propagate up the DOM hierarchy, or not.
charCode
Retrieves the Unicode character code of the key that generated the onkeypress event.
detail
Returns an integer value that specifies additional information about the event.
isChar
Returns whether the character that belongs to the current event is a key character or not.
keyCode
Sets or retrieves the Unicode character code of the key that generated the onkeypress event and the Unicode key code of the key that generated the onkeydown and onkeyup events.
layerX
Retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the closest positioned ancestor element of the element that fires the event.
layerY
Retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the closest positioned ancestor element of the element that fires the event.
pageX
Retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the document.
pageY
Retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the document.
rangeOffset
Returns the end position of the current selection relative to the element referred to by the rangeParent.
rangeParent
Returns a reference to the element where the selection ends.
view
Returns a reference to the AbstractView object where the event occurred.
which
Returns the Unicode character or key code of the key or the identifier of the mouse button that was pressed when the current event fired.

Methods:

Name Support Description
getPreventDefault
Returns whether the default action of the current event is canceled or not.
initUIEvent
Initializes an event object created by the createEvent method with type of 'UIEvent'.

Additional members of the WheelEvent interface:

Browser support:
Click here to see this interface in the inheritance hierarchy. If you need an object that implements this interface, see the page for the event object.

Properties:

Name Support Description
altKey
Sets or retrieves a Boolean value that indicates whether the left or right ALT key was down at the time when the event occurred.
clientX
Sets or returns the x-coordinate of the mouse pointer relative to the top-left corner of the browser window's client area.
clientY
Sets or returns the y-coordinate of the mouse pointer relative to the top-left corner of the browser window's client area.
ctrlKey
Sets or retrieves whether the left or right CTRL key was down at the time when the event occurred.
metaKey
Retrieves a Boolean value that indicates whether the META key was down at the time when the event occurred.
offsetX
Sets or retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the offsetParent element of the element that fires the event.
offsetY
Sets or retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the offsetParent element of the element that fires the event.
screenX
Sets or retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the screen.
screenY
Sets or retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the screen.
shiftKey
Sets or retrieves a Boolean value that indicates whether the left or right SHIFT key was down at the time when the event occurred.
wheelDelta
Returns an integer value indicating the distance that the mouse wheel rolled.
x
Sets or retrieves the x-coordinate of the mouse pointer relative to the top-left corner of the closest relatively positioned ancestor element of the element that fires the event.
y
Sets or retrieves the y-coordinate of the mouse pointer relative to the top-left corner of the closest relatively positioned ancestor element of the element that fires the event.

Examples:

This example shows how to add a method to the HTMLAnchorElement interface so this method can be used on all anchor elements:
<head>
    <script type="text/javascript">
        if (typeof HTMLAnchorElement != "undefined") {
            HTMLAnchorElement.prototype.GetHref = function () {
                alert (this.href);
            };
        }
        else {
            alert ("Your browser doesn't support this example!");
        }

        function GetAnchorHref () {
            var anchor = document.getElementById ("myAnchor");
            anchor.GetHref ();
        }
    </script>
</head>
<body>
    <a id="myAnchor" href="www.dottoro.com">an anchor element</a>
    <button onclick="GetAnchorHref ();">Get the href attribute of the anchor</button>
</body>
Did you find this example helpful? yes no
This example shows how to add a method to the HTMLElement interface so this method can be used on all elements:
<head>
    <script type="text/javascript">
        if (typeof HTMLElement != "undefined") {
            HTMLElement.prototype.GetTextContent = function () {
                var cont = (this.innerText != undefined)? this.innerText : this.textContent;
                alert (cont);
            };
        }
        else {
            alert ("Your browser doesn't support this example!");
        }

        function GetAnchorHref (button) {
            var anchor = document.getElementById ("myAnchor");
            anchor.GetTextContent ();
            button.GetTextContent ();
        }
    </script>
</head>
<body>
    <a id="myAnchor">an anchor element</a>
    <button onclick="GetAnchorHref (this);">Get the text content of the anchor and this button</button>
</body>
Did you find this example helpful? yes no
User Contributed Comments

Post Content

Post Content