Latest web development tutorials

type event properties

Event Object Reference Event objects

Definition and Usage

Event type property returns the type of event that occurred, the name of the current event Event object represents.

It is with the same name as the registered event handlers, or event handler attribute to remove a prefix "on" such as "submit", "load" or "click".

grammar

event.type


Examples

Examples

The following example may be triggered by the return type of the event:

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script type = "text / javascript">
function getEventType (event) {
alert (event.type);
}
</ Script>
</ Head>
<Body onmousedown = "getEventType (event)">

<P> Click on a location in the document. The message box will prompt you to trigger the event type. </ P>

</ Body>
</ Html>

try it"


Event Object Reference Event objects