Basic syntax of event handlers is:
<a href="www.google.com" onClick="alert("hello")">Google</a>
when user clicks on the link, it will prompt an alert box before being taken to Google.
Some of the most commonly supported eventhandlers:
OnClick Event Handler: OnClick event handler is executed when an element is clicked. It can only be added to visible elements on the page such as <a>, form buttons, check boxes, a DIV etc.
onMouseover and onMouseout event handleres can be added to visible elements such as a link (<a>), DIV, even inside the <BODY> tag, and are triggered when the mouse moves over and out of the element.
onMouseover and onMouseout events are often used to create "animated" buttons.
Applicability of Event Handlers
onAbort ---<img> tags
onBlur --- window object, all form objects
onClick---Most visible elements such as <a>, <div>, <body>
onError --- Text fields,Text Areas
onFocus---Most visible elements such as <a>, <div>, <body>
onLoad---<body>, <img>, and <frame>
onMouseover---Most visible elements such as <a>, <div>, <body>
onMouseout---Most visible elements such as <a>, <div>, <body>
onReset --- <form> tag, triggered when the form is resent via <input type="reset">
onSelect --- Elements with textual content. Most commonly used inside text fields and text areas
onSubmit --- <form> tag, triggered when the form is submitted
onUnload --- <body>---Most visible elements such as <a>, <div>, <body>
The Onload event is often used to check the visitor's browser type and browser version, and load the proper version of the web page based on the information.
onFocus, onBlur and onChange
These events are often used in combination with validation of form fields.
onSubmit event is used to validate All form fields before submitting it.