HTML and CSS Reference
Table 13.9 Properties of the event Object: Mozilla Firefox (continued)
What It Describes
The node from which the event originated.
Returns the time (in milliseconds since the epoch) the event was created.
Not all events return a timestamp.
A string indicating the type of event, such as “mouseover”, “click”, and so on.
Netscape legacy property indicating the Unicode for the key pressed.
Identical to charCode .
The bitmask representing modifier keys such as Alt, Shift, Meta, and so on.
Array of URLs for dragged and dropped.
height and width
Height and width of the window.
The srcElement/target and type Properties. The srcElement (Internet Explorer)
and the target properties (Firefox) return the element that fired the event. The srcEle-
ment also has a tagName property: event.srcElement.tagName will return “IMG” if you
click on an image object. And we can also read styles, so if the image has a style height
of 100px, then event.srcElement.style.height will return “100px”.
The type property contains the event name (e.g., click , mouseover , keypress , and so
on). This is the same for nonphysical events. If we capture and handle an onload event,
type will be “load”, and so on.
<!--Internet Explorer has srcElement property-->
<!--Firefox has target property-->
<!--Opera has both-->
onClick="alert( event.type + ' ' + event.srcElement );">
onClick="alert( event.type + ' ' + event.target );" />