Visit Mozilla.org

DOM:event.type

From MDC

« Gecko DOM Reference

Contents

[edit] Summary

Returns the name of the event (case-insensitive).

[edit] Syntax

string = event.type

[edit] Example

<html>
<head>

<title>type example</title>

<script type="text/javascript">
var currEvent = null;

function getEvtType(evt) {
  currEvent = evt.type;
  document.getElementById("Etype").firstChild.nodeValue = currEvent;
}

</script>
</head>

<body
  onkeydown="getEvtType(event)"
  onkeyup="getEvtType(event)"
  onmousedown="getEvtType(event)"
  onmouseup="getEvtType(event)">

<p>Press any key or click the mouse to get the event type.</p>
<p>Event type: <span id="Etype">-</span></p>

</body>
</html>

[edit] Notes

The type must be an XML name..

[edit] Specification

type