Event Handlers in Javascript
Event Handlers in Javascript
Event:
A function or method containing program statements that are executed in response to an event.
Event Handler:
An event handler typically is a software routine that processes actions such as keystrokes and mouse movements. With Web sites, event handlers make Web content dynamic. JavaScript is a common method of scripting event handlers for Web content. The events can be classified into two major types as follows Interactive events Non-Interactive events
Interactive events:
Events that are invoked by direct user interaction with the object is called as interactive events. Some of the interactive events are: onClick onMouseOver onMouseOut onReset onSubmit onAbort
<form name="myform"> <input type="text" name="data" value="" size=10> <INPUT TYPE="button" VALUE="Click Here" onClick="valid(this.form)"> </form> </BODY> </HTML>
Non-Interactive events:
Events that are not invoked by direct user interaction but by indirect actions such as on loading of an image or a page or while leaving a website etc. onLoad onUnload