Event Handling
Previous Page | Home Page | Next Page |
---|
An event is an action that occurs when a user interacts with a
web page or other browser related activities. For Example: when auser clicks a mouse button or enters data in a form, an event isgenerated. The browser waits for the event to occur, and takes anappropriate action according to the type of event. The action takenby the browser to an event is known as event handling.The function that is executed in response to the event is called anevent handler.
The following figure shows an event and the process of eventhandling:
Event Handling in JavaScript takes place in two steps:
- Defining events such that they are handled by the script.
- Connecting these events to JavaScript code.
JavaScript has predefined events for links, images, form elements,windows (a window refers to the body of a document containing HTMLcontent) and event handlers.
The following table structure shows few events, description and the event handlers associated with HTML elements:
An above example showing the use of Events and Event Handlersassociated with HTML elements:
Previous Page | Home Page | Next Page |
---|