An event handler is a part of a computer program created to tell the program how to act in response to a specific event (e.g. the clicking of a mouse or the dragging of a scrollbar or pressing a button). The programmer's custom event handling functions will be executed by the event dispatcher. The event dispatcher is part of the operating system that detects Graphical User Interface (GUI) events, and calls functions in the executing program to handle those events.
Without event handlers nothing would happen when you interacted with an event driven program, as most GUI programs are.
How event handlers function is highly dependent on the operating system, programming language, and GUI framework used. A programmer will need to consult the documentation provided with the language used to get the exact syntax and usage of event handling. A user only needs to know how their operating system functions. Users do not need to have any knowledge of the underlying event handler code.
The Event interface itself is described, as well as the interfaces for event registration on nodes in the DOM, eventhandlers and event listeners, and several longer examples that show how the various event interfaces relate to one another.
Eventhandlers may be attached to various elements in the DOM.
These and the various EventHandlers on HTML or XML elements are the main entry points for events in the DOM.
Event bubbling ensures that the eventhandlers for all elements in which an event occurs have an opportunity to respond to the event.
Eventhandlers can return values to the event either by using the return value mechanism defined for the language, such as the return statement for JScript, or by using the returnValue property of the event object.
For the onmouseover and onmouseout events, the toElement and fromElement properties specify the elements the mouse is moving to and from.