Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

event attribute | event property

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

Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5

 

Syntax

HTML<element event="p" ... >
JavaScript

p = object.event

 

Property values

Type: String

The event. The value for an onmouseover event, for example, is "onmouseover()".

Standards information

Examples

This example uses the event attribute and the event property to handle the click event.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/event.htm


<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="console.log(oButtonScript.event)">Flip</button>

See also

script
event

 

 

Show:
© 2015 Microsoft