DOM Event
interface
Event handlers may be attached to various objects including DOM elements, document, the window object, etc. When an event occurs, an event object is created and passed sequentially to the event listeners.
The DOM Event
interface is accessible from within the handler function, via the event object passed as the first argument. The following simple example shows how an event object is passed to the event handler function, and can be used from within one such function.
function foo(evt) {
// the evt parameter is automatically assigned the event object
alert(evt);
}