C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...








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:
onclick
onload
onmouseover
onkeypress

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.

<html>
<head>
<script type="text/javascript">
<!--
function FireMsg()
{
alert("Button Clicked")
}
//-->
</script>
</head>
<body>

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

Execution:


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


Tutorial Index




Read TATA Nano reviews.
dotNet Slackers   BizTalk Adaptors    Web Design   Scripts
Are you waiting for engineering entrance result? Watch here for engineering entrance results.
email fax service

Contact Us    Privacy Policy    Terms Of Use