Event-driven model (Definition)

A contextual manner in which script functions are executed.

Events are generated by all kinds of occurrences. For example, an event is generated when a web page has finished loading.

Some events are triggered as a result of some user interaction, for example, clicking a mouse button or passing a mouse pointer across the screen. As the mouse crosses over an item on the screen, it generates an event signifying that the mouse has entered the region occupied by the screen item. Similarly, an event is generated when the mouse moves away from the item.

Other events can be generated by plugins as they execute some special dynamic animated or audio/visual presentation.

Sometimes these events may be useful to trap a form submission or maybe a user has entered some data into a text cell and you want to check it right away before the user does something else.

Sometimes, events might be generated on a regular basis with an interval timer.

There are other more subtle events such as errors, property changes and focus changes. Some of these are derived and are triggered as a consequence of other events.

There is an association between an event and an event handler. The handler is a JavaScript function having the same or a similar name as the event. If an event handler is not present, then the event is discarded and the browser continues interacting with the user.

See also:Element.onevent, MutationEvent object