Event Handlers


 

JavaScript functions explained
JavaScript variables explained
JavaScript handlers explained
JavaScript parameters explained
A Tutorial about the rollover code
Frequently asked questions

 

 

Event handlers are built-in JavaScript functions, they are triggered by the occurrence of certain events within the application. These can be interactive or non-interactive events. Interactive events are triggered by the user, while a non-interactive event handler can be triggered automatically. Examples of interactive event handlers are onClick (the user clicks on something), onMouseOver (the mouse is moved over an area or link), and onSubmit (when the user submits a form). Non-interactive event handlers are, onLoad (when a page loads) and onUnload (when a document is exited).

Here are examples of interactive and non interactive event handlers
  <input type ="button" VALUE ="Interactive" onClick=
   »"alert('This message was triggerd by the onClick event handler')"">
		
  <body onLoad="alert('This message was triggerd by the onLoad event
   »handler')">
		

Event Handlers can be used to call functions, for example, when the user rolls the mouse over an image, the onMouseOver event handler can call the image swap function.