Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
HTML and CSS
Properties
 event Property

  Switch on low bandwidth view
EVENT Attribute | event Property

Sets or retrieves the event for which the script is written.

Syntax

HTML<ELEMENT EVENT = sEvent... >
Scripting[ sEvent = ] object.event

Possible Values

sEventString that specifies or receives the event. The value for an onmouseover event, for example, is "onmouseover()".

The property is read/write. The property has no default value.

DHTML expressions can be used in place of the preceding value(s). As of Internet Explorer 8, expressions are not supported in IE8 mode. For more information, see About Dynamic Properties.

Example

This example uses the EVENT attribute and the event property to handle the onclick event.

<SCRIPT ID=oButtonScript FOR="oButton" EVENT="onclick()">
    var sMessage1 = "Flip"
    var sMessage2 = "Flop"
    if (oButton.innerText == sMessage1) {
        oButton.innerText = sMessage2;
        }
    else {
    if (oButton.innerText == sMessage2) {
        oButton.innerText = sMessage1;
        }
</SCRIPT>
</HEAD>
<BODY>
:
<BUTTON ID="oButton" onmouseout="alert(oButtonScript.event)">Flip</BUTTON>
This feature requires Microsoft Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

This property is defined in World Wide Web Consortium (W3C) Document Object Model (DOM) Level 2 World Wide Web link.

Applies To

SCRIPT, HTMLScriptElement Constructor, Window Constructor

See Also

event
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
unclarification      Mr. Raymond Kenneth Petry   |   Edit   |   Show History

A mite-confusing just what this is ...

This property returns the string-value of the event name-specification, i.e. it might better be called eventNameSpec ... it may-or-not have parentheses, which are mostly-ignored anyway e.g. EVENT=onfocus((((( works, and returns id.event="onfocus(((((".

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker