Explain about Events in Java Script

Java script is an event drives system. An event is any change that the user makes to the state of browser. Java script event handling can be quit a complex issue. Different manufactures have implemented their own ways of capturing and handling events.

Java Script Events:-

Events
Handler
Description
1)
Blur
onBlur ( )
The input focus is moved from the object.
2)
Click
onClick ( )
The mouse is clicked once on the element of the page.
3)
Dbclick
onDbclick ( )
A form element (or) a link is clicked twice
4)
Focus
onFocus ( )
Input focus is given to an element. (the reverse of blur)
5)
Keydown
onKeyDown( )
A key is pressed but not released
6)
Mouseover
onMouseOver( )
The mouse pointer is moved over an element.
7)
Resize
onResize ( )
A window is resized by the user.
8)
Submit
onSubmit ( )
A form is submitted
9)
Unload
onUnload( )
The user leaves the webpage.
10)
Load
onLoad ( )
The page is reloaded by the browser.

Where you want an action from the user to load to some action from a script you will need to implement an event handles. Event handles are java script functions which you associate with an html element as part  of its definition in the html source code.

Each of the event handles perform an identical task when they are called an alert dialogue is used to display in the a message. The messages differ so that we can interact which event has just occurred and which object caused it.

Java Script Objects and Event Handlers:-

Object
Event handler
1)
Window
onLoad
onUnload
onBlur
onFocus
2)
Link
onClick
onMouseOut
onMouseOver
3)
Form
onLoad
onRest
onSumbit
4)
Text
onBlur
onChange
onFocus
5)
Button
onClick.
6)
Reset
onClick.
7)
Submit
onClick
onBlur
8)
Select
onChange
onFocus.

Ex:

<html>
<body onLoad = “show( )” onUnload = “ say_Goodbye ( )”>
< script language = “ javascript”>
function show ( )
{
   alert (“ the page has loaded”);
}
function say-goodbye( )
{
  alert (“ Thanks for visiting”);
}
< /script>
< /body>
< /html>


Related

Web Technology 869411008156241117

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item