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 Handlers | Function of Event Handlers |
---|---|---|
1. | onabort | This Event Is Fired When Loading of any Image is interrupted. |
2. | onblur | An Element Loses Focus (Ex : User Select Other Text While Left The Previous Selected One) |
3. | onchange | This Event is Fired When Content of Any Text Field is Changed. |
4. | onclick | Mouse Click on Any Element (Ex : Button Click) |
5. | ondblclick | Double Mouse Click on Any Element (Ex : Button Click) |
6. | onerror | An Error Will Occurs At The Time of Loading The Document, Image , any other Element |
7. | onfocus | When Any Element Gets Focus (Like Select Ant Text) |
8. | onkeydown | When user pressed Any Keyboard Key |
9. | onkeypress | When user pressed any Keyboard key or held down |
10. | onkeyup | When user Released a Keyboard Key |
11. | onload | Loading on Any Web Page, Document or Image |
12. | onmousedown | When User press Mouse Button |
13. | onmousemove | When Mouse Pointer is Moved |
14. | onmouseout | Mouse Pointer is Moved off an Element |
15. | onmouseover | Mouse is Moved over an Element or Hot Spot on the Web Page |
16. | onmouseup | When User Released Mouse button |
17. | onreset | When user Click on Reset button |
18. | onresize | When Window or Frame is resized. |
19. | onselect | When User Select Any text |
20. | onsubmit | When user Click on submit button |
20. | onunload | When 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
Post a Comment