Tutorials » Javascript tutorials »

Understanding Events

This article explains about Javascript Events and their use

JavaScript comes with wide variety of events that are helpful in solving real world scenarios.The interesting thing in JavaScript is to create dynamic web pages that enhance user interaction.Javascript events help in building interactive web pages.

An event is defined as an item that fires based on action.

Commonly used events in JavaScript are:

Here is simple example for Javascript click event. We are trying to fire a message in an alert box when the button is clicked.

1. Create FireMsg method in the script tag based on the technical requirement.
Here we need to place the code related to the action that is performed when a button is clicked
In this case we are just trying to fire a message in alert box. You may try for user Id and password validation as an assignment
2. Assign this method in onclick event of the button.

<script type="text/javascript">
function FireMsg()
alert("Button Clicked")

<input type="button" value="Click Me!" onclick="FireMsg()"><br />


The way it executes is simple and straight forward. When user clicks on button it fires the corresponding event and the functionality related to that event is executed. So simple !!

Next Chapter: Important points to make a note about JavaScript
Previous Chapter: Math Object - Example
More Chapters: Javascript Tutorials
More Tutorials: Tutorial Index

Top Contributors
TodayLast 7 Daysmore...

Awards & Gifts

Online Members

Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India