XML DOM type event attribute

Definition and usage

The type event attribute returns the type of the event that occurred, that is, the name of the event represented by the current Event object.

It has the same name as the registered event handler, or the prefix "on" of the event handler attribute is removed before, such as "submit", "load", or "click".

Syntax

event.type

Example

The following examples can return the type of triggered event:

<html>
<head>
<script type="text/javascript">
function getEventType(event)
  { 
  alert(event.type);
  }
</script>
</head>
<body onmousedown="getEventType(event)">
<p>Click somewhere in the document.
An alert box will tell what event 
type you triggered.</p>
</body>
</html>

TIY

type event
Return the type of triggered event (IE browser does not support).