JavaScript Event


javascript event

Events and Event Handlers

In JavaScript , There are lots of Events Which React According To The User

Response in HTML Web Page or Document . When any Event Will Occur

Event handlers Will handle this Fired Event .

Example of Events :

1. When User Click on Any button.

2. Mouse Over on Any Hyper Link Or Hot Spot on Web Page

3. Submitting The Application Form

4. Loading of Any Image or Web page

5. When Any Key is Pressed or Released.

6. When Any Input Fields Modified.

List of The JavaScript Events Handlers

Here , is the name of the JavaScript Events Handlers

Sr.Event HandlersFunction of Event Handlers
1.onabortThis Event Is Fired When Loading of any Image is interrupted.
2.onblurAn Element Loses Focus (Ex : User Select Other Text While Left The Previous Selected One)
3.onchangeThis Event is Fired When Content of Any Text Field is Changed.
4.onclickMouse Click on Any Element (Ex : Button Click)
5.ondblclickDouble Mouse Click on Any Element (Ex : Button Click)
6.onerrorAn Error Will Occurs At The Time of Loading The Document, Image , any other Element
7.onfocusWhen Any Element Gets Focus (Like Select Ant Text)
8.onkeydownWhen user pressed Any Keyboard Key
9.onkeypressWhen user pressed any Keyboard key or held down
10.onkeyupWhen user Released a Keyboard Key
11.onloadLoading on Any Web Page, Document or Image
12.onmousedownWhen User press Mouse Button
13.onmousemoveWhen Mouse Pointer is Moved
14.onmouseoutMouse Pointer is Moved off an Element
15.onmouseoverMouse is Moved over an Element or Hot Spot on the Web Page
16.onmouseupWhen User Released Mouse button
17.onresetWhen user Click on Reset button
18.onresizeWhen Window or Frame is resized.
19.onselectWhen User Select Any text
20.onsubmitWhen user Click on submit button
20.onunloadWhen User Exits The page

Ex-1. Onclick Event

In This Example , When You Click on i-World-Tech button it Will goes To The

Specified Link www.i-world-tech.blogspot.in



<html>
<head>
<title> onclick Examples</title>
<script type="text/javascript">
function loc(url)
{
window.location=url;
}
</script>
</head>
<body>
<h1> i-World-Tech </h1>
<input type="button" value="i-World-Tech" onclick="loc('http://www.i-world-tech.blogspot.in')">
</body>
</html>

Ex-2. onload Event

When Web Page is Load Then It Will Show you Alert Message .



<html>
<head>
<script type="text/javascript">
function message()
{
alert("My First java Script Program");
}
</script>
</head>

<body onload="message()">
</body>
</html>

Ex-3. onfocus , onblur and onchange Events

These All Events are Often Used in the Validation of The Form. Function of

These Three Events is Already Specified in the Above table.

<input type="text" name="username" size="40" id="u1" onchange="user()">

Ex-4. ommouseover and onmouseout



<html>
<head>
<title> onMouseover </title>
</head>
<body>
<h1> i-World-Tech Image </h1>
<a href="http://www.i-world-tech.blogspot.in"
onmouseover="alert(' WELCOME... i-World-tech user'); return false">
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1SB6gBjsA0mep0jBt_D9bHOC3uE1MlSXMHyeCnJOWu5bBnQSHqFvGp9FZ7u0hVaGd0JF9240yhzzjYn-u_di0OBa7BVjNQt24Zj2Tj_-UBqOvequo_Zb2sXAadjv5yMtcOQOp70y6IVk/s1600/
Original_on_invert_emblems_color_background_197x75.jpg">
</a>
</body>
</html>


i-World-Tech Image





Thank You To All My Reader
Deepak Gupta
www.i-world-tech.blogspot.in

Related Post

1. JavaScript Basic Part-1

2. Animated moving car program : computer graphics in c



5. JDK 8





Comments