SlideShare a Scribd company logo
1 of 13
JAVASCRIPT EVENTS
• Javascript-enabled Web pages are typically event
  driven. Events are actions that occur on the Web page.
  Generally speaking they occur when.
• Your browser does something such as loading or
  unloading a page.
• You do something like clicking a button, moving your
  mouse over a link, or moving your cursor into or out a
  form element.
• If these events which cause JavaScript code to spring
  into action. Each JavaScript event has a corresponding
  event handler that is charged with the responsibility of
  automatically responding to it when it occurs.
     Reference: http://www.wvu.edu˜ support/training/classmat/js/
EVENT HANDLERS
• Event handlers execute JavaScript code to respond to
  events whenever they occur.
• They what makes JavaScript so useful in creating
  interactive Web sites.

  Understanding "event handlers" in JavaScript
• So, what are event handlers? Very powerful and
  useful! They are JavaScript code that are not added
  inside the <script> tags, but rather, inside the html
  tags, that execute JavaScript when something
  happens, such as pressing a button, moving your
  mouse over a link, submitting a form etc. The basic
  syntax of these event handlers is:
                     Reference: Copyright © 1997-2012 JavaScript Kit.
Event Handlers can be divided into two parts:

• interactive Event Handlers and
• non-interactive Event Handlers
• An interactive Event Handler is the one that
  depends on the user interactivity with the form
  or the document. For example, onMouseOver is
  an interactive Event Handler because it depends
  on the users action with the mouse.
• On the other hand non-interactive Event Handler
  would be onLoad, because this Event Handler
  would automatically execute JavaScript code
  without the user's interactivity.
EVENT HANDLERS
Event Handler                         Event that it handles
onBlur          User has left the focus of the object. For example, they clicked
                away from a text field that was previously selected.

onChange        User has changed the object, then attempts to leave that field
                (i.e. clicks elsewhere).

onClick         User clicked on the object.
onDblClick      User clicked twice on the object.
onFocus         User brought the focus to the object (i.e. clicked on it/tabbed to
                it)
onKeydown       A key was pressed over an element.
onKeyup         A key was released over an element.
onKeypress      A key was pressed over an element then released.
onLoad          The object has loaded.                    Reference: quackit.com
Event Handler                 Event that it handles
onMousedown         The cursor moved over the object and
                    mouse/pointing device was pressed down.
onMouseup           The mouse/pointing device was released after being
                    pressed down.
onMouseover         The cursor moved over the object (i.e. user hovers the
                    mouse over the object).
onMousemove         The cursor moved while hovering over an object.

onMouseout          The cursor moved off the object
onReset             User has reset a form.
onSelect            User selected some or all of the contents of the
                    object. For example, the user selected some text
                    within a text field.
onSubmit            User submitted a form.
onUnload            User left the window (i.e. user closes the browser
                    window).
<HTML><HEAD>                                        Browser ‘s Output
<TITLE>Example of onBlur Event Handler</TITLE>
<SCRIPT>
function validateAnswer(answer) {
if (answer == "Brendan Eich")
{alert("Your answer is correct");}
else
{alert("Your answer is wrong") }
}
</SCRIPT></HEAD><BODY>
<H3> Example of onBlur Event Handler</H3>
Who created the JavaScript?:<BR>
<FORM>                              In this example, 'data' is a text field. When a
    <INPUT TYPE="text"              user attempts to leave the field,
     onBlur="validate(this.value)"> the onBlur Event Handler calls the valid()
</FORM>                             function to confirm that 'data' has a legal
</BODY>                             value. Note that the keyword this is used to
                                    refer to the current object.
</HTML>
<HTML><HEAD>                                     Browser’s Output
<TITLE>Example of onChange Event
Handler</TITLE>
<SCRIPT>
function valid(input)
{ alert("You have changed the value from Jesus
    to " + input);}
</SCRIPT>
</HEAD>
<BODY>
<H3>Example of onChange Event
Handler</H3>
Try changing the value from Jesus to something
    else:<BR>                                    In this example, 'data' is a text field.
<FORM>                                           When a user attempts to leave the
                                                 field after a change of the original
<INPUT TYPE="text“
                                                 value, the onChange Event Handler
VALUE=“Jesus" onChange="valid(this.value)“/>     calls the valid() function which alerts
    </FORM></BODY></HTML>                        the user about value that has been
                                                 inputted.
<HTML>                                 Browser’s Output
<HEAD><TITLE>Example of on Focus
   Event Handler</TITLE>
</HEAD>
<BODY>
<H3>Example of onFocus Event
   Handler</H3>
Click your mouse in the textbox:<BR>
<FORM>
<INPUT TYPE="text"
                                        In the above
onFocus='alert("You focused in the
   textbox!!")'>
                                        example, when you
                                        put your mouse on
</FORM>
                                        the text box,
</BODY>
                                        an alert() message
</HTML>
                                        displays a message.
<IMG SRC="images/object.gif"
  NAME="jsobjects"
   onLoad="alert('You loaded my image')">
  Browser’s Output
                         An onLoad event occurs
                         when a window or
                         image finishes loading.
                         For windows, this Event
                         Handler is specified in
                         the <BODY> attribute of
                         the window. In an image,
                         the Event Handler will
                         execute handler text
                         when the image is
                         loaded.
<html><head><script>                                  Browser’s Output
function bigImg(x)
{
x.style.height="64px";
x.style.width="64px";
}
function normalImg(x)
{
x.style.height="32px";
x.style.width="32px";
}
</script></head><body>

<img onmouseover="bigImg(this)"
   onmouseout="normalImg(this)" border="0"
   src="grasshopper.gif" alt=“Grasshopper"
   width="32" height="32">

<p>The function bigImg() is triggered when the user
   moves the mouse pointer over the image.</p>
<p>The function normalImg() is triggered when the
   mouse pointer is moved out of the image.</p>
</body></html>
Browser’s Output
•   <script>
•   function myFunction()
•   {
•   alert("You have selected
    some text!");
•   }
•   </script>
•   </head>
•   <body>

• Some text: <input
  type="text" value="Hello
  world!"                      On the above example, when the
                               value of the textbox was selected
  onselect="myFunction()">     an alert box displays a message
MATCHING TYPE: Match Column A to Column B. Write
          your answer on the space provided.
                      COLUMN A                                    COLUMN B
                  Event that it handles                          Event Handler

_________1. The cursor moved over the object and            a.   onChange
mouse/pointing device was pressed down.                     b.   onClick
_________2. The cursor moved over the object.               c.   onDblClick
_________3. User submitted a form.                          d.   onLoad
_________4. User clicked on the object.                     e.   onMousedown
_________5. The object has loaded.                          f.   onMouseover
_________6. User has changed the object, then attempts      g.   onMouseout
to leave that field (i.e. clicks elsewhere).                h.   onReset
_________7. The cursor moved off the object.                i.   onSelect
_________8. User has reset a form.                          j.   onSubmit
_________9. User clicked twice on the object.
_________10. User selected some or all of the contents of
the object.

More Related Content

What's hot

Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
Varun C M
 

What's hot (20)

JavaScript - Chapter 5 - Operators
 JavaScript - Chapter 5 - Operators JavaScript - Chapter 5 - Operators
JavaScript - Chapter 5 - Operators
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
JavaScript: Events Handling
JavaScript: Events HandlingJavaScript: Events Handling
JavaScript: Events Handling
 
Javascript variables and datatypes
Javascript variables and datatypesJavascript variables and datatypes
Javascript variables and datatypes
 
jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events jQuery -Chapter 2 - Selectors and Events
jQuery -Chapter 2 - Selectors and Events
 
Form Validation in JavaScript
Form Validation in JavaScriptForm Validation in JavaScript
Form Validation in JavaScript
 
Functions in javascript
Functions in javascriptFunctions in javascript
Functions in javascript
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
 
JQuery introduction
JQuery introductionJQuery introduction
JQuery introduction
 
Javascript arrays
Javascript arraysJavascript arrays
Javascript arrays
 
Html frames
Html framesHtml frames
Html frames
 
Database Connectivity in PHP
Database Connectivity in PHPDatabase Connectivity in PHP
Database Connectivity in PHP
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Complete Lecture on Css presentation
Complete Lecture on Css presentation Complete Lecture on Css presentation
Complete Lecture on Css presentation
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
MYSQL - PHP Database Connectivity
MYSQL - PHP Database ConnectivityMYSQL - PHP Database Connectivity
MYSQL - PHP Database Connectivity
 
JavaScript Control Statements I
JavaScript Control Statements IJavaScript Control Statements I
JavaScript Control Statements I
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
 
jQuery
jQueryjQuery
jQuery
 
JavaScript - Chapter 6 - Basic Functions
 JavaScript - Chapter 6 - Basic Functions JavaScript - Chapter 6 - Basic Functions
JavaScript - Chapter 6 - Basic Functions
 

Similar to Javascript event handler

Java script browser objects 1
Java script browser objects 1Java script browser objects 1
Java script browser objects 1
H K
 
Upstate CSCI 450 WebDev Chapter 9
Upstate CSCI 450 WebDev Chapter 9Upstate CSCI 450 WebDev Chapter 9
Upstate CSCI 450 WebDev Chapter 9
DanWooster1
 

Similar to Javascript event handler (20)

Unit3.pptx
Unit3.pptxUnit3.pptx
Unit3.pptx
 
JavaScript
JavaScriptJavaScript
JavaScript
 
JavaScript
JavaScriptJavaScript
JavaScript
 
DHTML - Events & Buttons
DHTML - Events  & ButtonsDHTML - Events  & Buttons
DHTML - Events & Buttons
 
Java script browser objects 1
Java script browser objects 1Java script browser objects 1
Java script browser objects 1
 
Presentation
PresentationPresentation
Presentation
 
Javascript 2
Javascript 2Javascript 2
Javascript 2
 
JavaScript_Events.pptx
JavaScript_Events.pptxJavaScript_Events.pptx
JavaScript_Events.pptx
 
Web programming
Web programmingWeb programming
Web programming
 
Lec 5
Lec 5Lec 5
Lec 5
 
Android 3
Android 3Android 3
Android 3
 
Upstate CSCI 450 WebDev Chapter 9
Upstate CSCI 450 WebDev Chapter 9Upstate CSCI 450 WebDev Chapter 9
Upstate CSCI 450 WebDev Chapter 9
 
Reacting to a Virtual World
Reacting to a Virtual WorldReacting to a Virtual World
Reacting to a Virtual World
 
5 .java script events
5 .java script   events5 .java script   events
5 .java script events
 
types of events in JS
types of events in JS types of events in JS
types of events in JS
 
Javascript #8 : événements
Javascript #8 : événementsJavascript #8 : événements
Javascript #8 : événements
 
JS basics
JS basicsJS basics
JS basics
 
Javascript Browser Events.pdf
Javascript Browser Events.pdfJavascript Browser Events.pdf
Javascript Browser Events.pdf
 
Androd Listeners
Androd ListenersAndrod Listeners
Androd Listeners
 
JavaScript with Syntax & Implementation
JavaScript with Syntax & ImplementationJavaScript with Syntax & Implementation
JavaScript with Syntax & Implementation
 

More from Jesus Obenita Jr.

Session 2 test construction.mt's
Session 2   test construction.mt'sSession 2   test construction.mt's
Session 2 test construction.mt's
Jesus Obenita Jr.
 

More from Jesus Obenita Jr. (20)

Organization and management 3 a Evolution of Management Theory
Organization and management 3 a Evolution of Management TheoryOrganization and management 3 a Evolution of Management Theory
Organization and management 3 a Evolution of Management Theory
 
Organization and management 2 Management Function
Organization and management 2 Management FunctionOrganization and management 2 Management Function
Organization and management 2 Management Function
 
Organization and management 1
Organization and management 1Organization and management 1
Organization and management 1
 
Designing web page marquee and img tag
Designing web page  marquee and img tagDesigning web page  marquee and img tag
Designing web page marquee and img tag
 
Ms excel 2013 formatting worksheets
Ms excel 2013 formatting worksheetsMs excel 2013 formatting worksheets
Ms excel 2013 formatting worksheets
 
Ms excel 2013 data management
Ms excel 2013 data managementMs excel 2013 data management
Ms excel 2013 data management
 
Microsoft Excel introduction
Microsoft Excel introductionMicrosoft Excel introduction
Microsoft Excel introduction
 
Word 2013 working with pictures
Word 2013 working with picturesWord 2013 working with pictures
Word 2013 working with pictures
 
Word 2013 Formatting Page
Word 2013 Formatting PageWord 2013 Formatting Page
Word 2013 Formatting Page
 
Word 2013 8
Word 2013 8Word 2013 8
Word 2013 8
 
Ms word 2013 7
Ms word 2013 7Ms word 2013 7
Ms word 2013 7
 
Ms word 2013 6
Ms word 2013 6Ms word 2013 6
Ms word 2013 6
 
Ms word 2013 4
Ms word 2013 4Ms word 2013 4
Ms word 2013 4
 
Ms word 2013 2
Ms word 2013 2Ms word 2013 2
Ms word 2013 2
 
Ms word 2013
Ms word 2013Ms word 2013
Ms word 2013
 
Parts of the ms word 2013 screen and
Parts of the ms word 2013 screen andParts of the ms word 2013 screen and
Parts of the ms word 2013 screen and
 
Word processor
Word processorWord processor
Word processor
 
Session 2 test construction.mt's
Session 2   test construction.mt'sSession 2   test construction.mt's
Session 2 test construction.mt's
 
Cooking ingredients
Cooking ingredientsCooking ingredients
Cooking ingredients
 
Color theory
Color theoryColor theory
Color theory
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 

Recently uploaded (20)

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 

Javascript event handler

  • 1.
  • 2. JAVASCRIPT EVENTS • Javascript-enabled Web pages are typically event driven. Events are actions that occur on the Web page. Generally speaking they occur when. • Your browser does something such as loading or unloading a page. • You do something like clicking a button, moving your mouse over a link, or moving your cursor into or out a form element. • If these events which cause JavaScript code to spring into action. Each JavaScript event has a corresponding event handler that is charged with the responsibility of automatically responding to it when it occurs. Reference: http://www.wvu.edu˜ support/training/classmat/js/
  • 3. EVENT HANDLERS • Event handlers execute JavaScript code to respond to events whenever they occur. • They what makes JavaScript so useful in creating interactive Web sites. Understanding "event handlers" in JavaScript • So, what are event handlers? Very powerful and useful! They are JavaScript code that are not added inside the <script> tags, but rather, inside the html tags, that execute JavaScript when something happens, such as pressing a button, moving your mouse over a link, submitting a form etc. The basic syntax of these event handlers is: Reference: Copyright © 1997-2012 JavaScript Kit.
  • 4. Event Handlers can be divided into two parts: • interactive Event Handlers and • non-interactive Event Handlers • An interactive Event Handler is the one that depends on the user interactivity with the form or the document. For example, onMouseOver is an interactive Event Handler because it depends on the users action with the mouse. • On the other hand non-interactive Event Handler would be onLoad, because this Event Handler would automatically execute JavaScript code without the user's interactivity.
  • 5. EVENT HANDLERS Event Handler Event that it handles onBlur User has left the focus of the object. For example, they clicked away from a text field that was previously selected. onChange User has changed the object, then attempts to leave that field (i.e. clicks elsewhere). onClick User clicked on the object. onDblClick User clicked twice on the object. onFocus User brought the focus to the object (i.e. clicked on it/tabbed to it) onKeydown A key was pressed over an element. onKeyup A key was released over an element. onKeypress A key was pressed over an element then released. onLoad The object has loaded. Reference: quackit.com
  • 6. Event Handler Event that it handles onMousedown The cursor moved over the object and mouse/pointing device was pressed down. onMouseup The mouse/pointing device was released after being pressed down. onMouseover The cursor moved over the object (i.e. user hovers the mouse over the object). onMousemove The cursor moved while hovering over an object. onMouseout The cursor moved off the object onReset User has reset a form. onSelect User selected some or all of the contents of the object. For example, the user selected some text within a text field. onSubmit User submitted a form. onUnload User left the window (i.e. user closes the browser window).
  • 7. <HTML><HEAD> Browser ‘s Output <TITLE>Example of onBlur Event Handler</TITLE> <SCRIPT> function validateAnswer(answer) { if (answer == "Brendan Eich") {alert("Your answer is correct");} else {alert("Your answer is wrong") } } </SCRIPT></HEAD><BODY> <H3> Example of onBlur Event Handler</H3> Who created the JavaScript?:<BR> <FORM> In this example, 'data' is a text field. When a <INPUT TYPE="text" user attempts to leave the field, onBlur="validate(this.value)"> the onBlur Event Handler calls the valid() </FORM> function to confirm that 'data' has a legal </BODY> value. Note that the keyword this is used to refer to the current object. </HTML>
  • 8. <HTML><HEAD> Browser’s Output <TITLE>Example of onChange Event Handler</TITLE> <SCRIPT> function valid(input) { alert("You have changed the value from Jesus to " + input);} </SCRIPT> </HEAD> <BODY> <H3>Example of onChange Event Handler</H3> Try changing the value from Jesus to something else:<BR> In this example, 'data' is a text field. <FORM> When a user attempts to leave the field after a change of the original <INPUT TYPE="text“ value, the onChange Event Handler VALUE=“Jesus" onChange="valid(this.value)“/> calls the valid() function which alerts </FORM></BODY></HTML> the user about value that has been inputted.
  • 9. <HTML> Browser’s Output <HEAD><TITLE>Example of on Focus Event Handler</TITLE> </HEAD> <BODY> <H3>Example of onFocus Event Handler</H3> Click your mouse in the textbox:<BR> <FORM> <INPUT TYPE="text" In the above onFocus='alert("You focused in the textbox!!")'> example, when you put your mouse on </FORM> the text box, </BODY> an alert() message </HTML> displays a message.
  • 10. <IMG SRC="images/object.gif" NAME="jsobjects" onLoad="alert('You loaded my image')"> Browser’s Output An onLoad event occurs when a window or image finishes loading. For windows, this Event Handler is specified in the <BODY> attribute of the window. In an image, the Event Handler will execute handler text when the image is loaded.
  • 11. <html><head><script> Browser’s Output function bigImg(x) { x.style.height="64px"; x.style.width="64px"; } function normalImg(x) { x.style.height="32px"; x.style.width="32px"; } </script></head><body> <img onmouseover="bigImg(this)" onmouseout="normalImg(this)" border="0" src="grasshopper.gif" alt=“Grasshopper" width="32" height="32"> <p>The function bigImg() is triggered when the user moves the mouse pointer over the image.</p> <p>The function normalImg() is triggered when the mouse pointer is moved out of the image.</p> </body></html>
  • 12. Browser’s Output • <script> • function myFunction() • { • alert("You have selected some text!"); • } • </script> • </head> • <body> • Some text: <input type="text" value="Hello world!" On the above example, when the value of the textbox was selected onselect="myFunction()"> an alert box displays a message
  • 13. MATCHING TYPE: Match Column A to Column B. Write your answer on the space provided. COLUMN A COLUMN B Event that it handles Event Handler _________1. The cursor moved over the object and a. onChange mouse/pointing device was pressed down. b. onClick _________2. The cursor moved over the object. c. onDblClick _________3. User submitted a form. d. onLoad _________4. User clicked on the object. e. onMousedown _________5. The object has loaded. f. onMouseover _________6. User has changed the object, then attempts g. onMouseout to leave that field (i.e. clicks elsewhere). h. onReset _________7. The cursor moved off the object. i. onSelect _________8. User has reset a form. j. onSubmit _________9. User clicked twice on the object. _________10. User selected some or all of the contents of the object.