Windows Dev Center

EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

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

See also

script
event

 

 

Build date: 10/15/2012

Anzeigen:
© 2015 Microsoft