SlideShare a Scribd company logo
1 of 26
JavaScript:
              Event Model
               November 1, 2005

                   Slides modified from
Internet & World Wide Web: How to Program. 2004 (3rd)
  edition. By Deitel, Deitel, and Goldberg. Published by
            Prentice Hall. ISBN 0-13-145091-3



                                                           1
Chapter 14 – Dynamic HTML:
          Event Model


Outline
14.1      Introduction
14.2      Event onclick
14.3      Event onload
14.4      Error Handling with onerror
14.5      Tracking the Mouse with Event onmousemove
14.6      Rollovers with onmouseover and onmouseout
14.7      Form Processing with onfocus and onblur
14.8      More Form Processing with onsubmit and onreset
14.9      Event Bubbling
14.10     More DHTML Events
14.11     Web Resources

                                                           2
Objectives
• In this lesson, you will learn:
  – To understand the notion of events, event
    handlers and event bubbling.
  – To be able to create event handlers that
    respond to mouse and keyboard events.
  – To be able to use the event object to be
    made aware of and, ultimately, respond to
    user actions.
  – To understand how to recognize and respond
    to the most popular events.
                                                 3
14.1 Introduction
• Event model
  – Scripts can respond to user
  – Content becomes more dynamic
  – Interfaces become more intuitive




                                       4
Three different event models:
• Internet Explorer
   – http://msdn.microsoft.com/workshop/author/om/event_model.asp
• Gecko (Firefox, Netscape, Mozilla)
   – http://mozref.com/reference/specifications/DOM2Events
• W3C
   – http://www.w3.org/TR/DOM-Level-2-Events/events.html


• Reconciliations
   – http://www.oreillynet.com/pub/a/javascript/synd/2001/09/25/even
     t_models.html?page=2
   – http://www.javascriptkit.com/dhtmltutors/domevent1.shtml
   – Event object: http://www.javascriptkit.com/jsref/event.shtml

                                                                   5
14.2 Event onclick
• onClick
   – Invoked when user clicks the mouse on a
     specific item




                                               6
onclick.html
  (1 of 2)




               7
14.3  Event onload 
• onload event
   – Fires when an element finishes loading
   – Used in the body element
   – Initiates a script after the page loads into the 
     client




                                                         8
onload.html
                                         (1 of 2)
26    </head>
27
28    <body onload = "startTimer()">
29
30       <p>Seconds you have spent viewing this page so far:
31       <strong id = “soFar”>0</strong></p>
32
33    </body>
34 </html>
                                                               9
14.4  Error Handling with 
       onerror 
• onerror event
   – Execute specialized error-handling code




                                               10
onerror.html
  (2 of 2)




               11
14.5  Tracking the Mouse 
       with Event onmousemove 
• onmousemove
   – Fires repeatedly when the user moves the 
     mouse over the Web page
   – Gives position of the mouse




                                                 12
onmousemove.html
     (2 of 2)




                   13
14.6  Rollovers with 
      onmouseover and onmouseout 
• Two more events fired by mouse 
  movements
  – onmouseover
    • Mouse cursor moves over element
  – Onmouseout
    • Mouse cursor leaves element




                                        14
15
16
14.7  Form Processing with 
      onfocus and onblur 
• onfocus event fires when element gains 
 focus
• onblur event fires when element loses 
 focus




                                            17
onfocusblur.html
    (2 of 3)




                   18
14.8  More Form Processing 
      with onsubmit and onreset 
• onsubmit and onreset are useful events 
 for processing forms




                                            19
1    <?xml version = "1.0"?>
2    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5    <!-- Fig 14.8: onsubmitreset.html                     -->
6    <!-- Demonstrating the onsubmit and onreset events -->
7
8    <html xmlns = "http://www.w3.org/1999/xhtml">
9      <head>
10         <title>
11
12
13
           </title>            onsubmitreset.html
                DHTML Event Model - onsubmit and onreset events


           <script type = "text/javascript">
14
15
                <!--
                var helpArray =     (1 of 4)
16                [ "Enter your name in this input box.",
17                     "Enter your email address in this input box, " +
18                     "in the format user@domain.",
19                     "Check this box if you liked our site.",
20                     "In this box, enter any comments you would " +
21                     "like us to read.",
22                     "This button submits the form to the " +
23                     "server-side script",
24                     "This button clears the form",
25                     "This textarea provides context-sensitive " +



                                                                          20
35            function formSubmit() {
36                window.event.returnValue = false;
37
38                if ( confirm ( "Are you sure you want to submit?" ) )
39                   window.event.returnValue = true;
40            }
41
42            function formReset() {
43                window.event.returnValue = false;
44
45
46
                            onsubmitreset.html
                  if ( confirm( "Are you sure you want to reset?" ) )
                     window.event.returnValue = true;



                                 (2 of 4)
47            }
48            // -->
49      </script>
50   </head>
51
52   <body>
53
54      <form id = "myForm" onsubmit = "formSubmit()"
55            onreset = "formReset()" action = "">
56      Name: <input type = "text" name = "name"
57            onfocus =   "helpText(0)" onblur = "helpText(6)" /><br />
58      Email: <input type = "text" name = "email"
59            onfocus = "helpText(1)" onblur = "helpText(6)" /><br />
60      Click here if you like this site
61     <input type = "checkbox" name = "like" onfocus =
62            "helpText(2)" onblur = "helpText(6)" /><hr />
                                                                          21
63
51
52   <body>
53
54      <form id = "myForm" onsubmit = "formSubmit()"
55            onreset = "formReset()" action = "">
56      Name: <input type = "text" name = "name"
57            onfocus =   "helpText(0)" onblur = "helpText(6)" /><br />
58      Email: <input type = "text" name = "email"
59            onfocus = "helpText(1)" onblur = "helpText(6)" /><br />
60      Click here if you like this site
61
62
63
                            onsubmitreset.html
       <input type = "checkbox" name = "like" onfocus =
              "helpText(2)" onblur = "helpText(6)" /><hr />


64
65
66
        Any comments?<br />
                                 (3 of 4)
       <textarea name = "comments" rows = "5" cols = "45"
              onfocus = "helpText(3)" onblur = "helpText(6)">
67     </textarea><br />
68     <input type = "submit" value = "Submit" onfocus =
69        "helpText(4)"      onblur = "helpText(6)" />
70     <input type = "reset" value = "Reset" onfocus =
71            "helpText(5)" onblur = "helpText(6)" />
72
73     <textarea name = "helpBox" style = "position: absolute;
74            right:0; top: 0" rows = "4" cols = "45">
75      This textarea provides context-sensitive help. Click on



                                                                          22
14.9 Event Bubbling
• Crucial part of the event model
• Process whereby events fired in child
  elements “bubble” up to their parent
  elements




                                          23
bubbling.html
   (2 of 2)




                24
25
14.10 More DHTML
       Events
• Remaining DHTML events and their
  descriptions
• http://www.w3schools.com/jsref/jsref_events.asp




                                                26

More Related Content

What's hot

Introj Query Pt2
Introj Query Pt2Introj Query Pt2
Introj Query Pt2
kshyju
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
Utkarsh Mankad
 

What's hot (19)

DHTML - Events & Buttons
DHTML - Events  & ButtonsDHTML - Events  & Buttons
DHTML - Events & Buttons
 
Events
EventsEvents
Events
 
Introj Query Pt2
Introj Query Pt2Introj Query Pt2
Introj Query Pt2
 
jQuery Behaviours
jQuery BehavioursjQuery Behaviours
jQuery Behaviours
 
Client Web
Client WebClient Web
Client Web
 
types of events in JS
types of events in JS types of events in JS
types of events in JS
 
5 .java script events
5 .java script   events5 .java script   events
5 .java script events
 
JavaScript Libraries
JavaScript LibrariesJavaScript Libraries
JavaScript Libraries
 
A comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter componentA comprehensive guide on developing responsive and common react filter component
A comprehensive guide on developing responsive and common react filter component
 
Android activity, service, and broadcast recievers
Android activity, service, and broadcast recieversAndroid activity, service, and broadcast recievers
Android activity, service, and broadcast recievers
 
Meet VueJs
Meet VueJsMeet VueJs
Meet VueJs
 
Event
EventEvent
Event
 
Javascript #8 : événements
Javascript #8 : événementsJavascript #8 : événements
Javascript #8 : événements
 
Lessons Learned: Migrating Tests to Selenium v2
Lessons Learned: Migrating Tests to Selenium v2Lessons Learned: Migrating Tests to Selenium v2
Lessons Learned: Migrating Tests to Selenium v2
 
A Journey with React
A Journey with ReactA Journey with React
A Journey with React
 
DOM Events
DOM EventsDOM Events
DOM Events
 
Events - Part 2
Events - Part 2Events - Part 2
Events - Part 2
 
JavaScript
JavaScriptJavaScript
JavaScript
 
lect4
lect4lect4
lect4
 

Similar to Js events

Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mohammad Shaker
 
HTML5 & The Open Web - at Nackademin
HTML5 & The Open Web -  at NackademinHTML5 & The Open Web -  at Nackademin
HTML5 & The Open Web - at Nackademin
Robert Nyman
 

Similar to Js events (20)

Dynamic HTML Event Model
Dynamic HTML Event ModelDynamic HTML Event Model
Dynamic HTML Event Model
 
Event Programming JavaScript
Event Programming JavaScriptEvent Programming JavaScript
Event Programming JavaScript
 
javascript Event Handling and introduction to event.ppt
javascript Event Handling and introduction to event.pptjavascript Event Handling and introduction to event.ppt
javascript Event Handling and introduction to event.ppt
 
CS101- Introduction to Computing- Lecture 32
CS101- Introduction to Computing- Lecture 32CS101- Introduction to Computing- Lecture 32
CS101- Introduction to Computing- Lecture 32
 
Measuring Continuity
Measuring ContinuityMeasuring Continuity
Measuring Continuity
 
Java script
Java scriptJava script
Java script
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOS
 
Javascript Browser Events.pdf
Javascript Browser Events.pdfJavascript Browser Events.pdf
Javascript Browser Events.pdf
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Pushing the Web: Interesting things to Know
Pushing the Web: Interesting things to KnowPushing the Web: Interesting things to Know
Pushing the Web: Interesting things to Know
 
B2. activity and intent
B2. activity and intentB2. activity and intent
B2. activity and intent
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 Apps
 
Web programming
Web programmingWeb programming
Web programming
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhone
 
Synapse india dotnet development web approch part 2
Synapse india dotnet development web approch part 2Synapse india dotnet development web approch part 2
Synapse india dotnet development web approch part 2
 
OpenWhisk Lab
OpenWhisk Lab OpenWhisk Lab
OpenWhisk Lab
 
Untangling8
Untangling8Untangling8
Untangling8
 
HTML5 & The Open Web - at Nackademin
HTML5 & The Open Web -  at NackademinHTML5 & The Open Web -  at Nackademin
HTML5 & The Open Web - at Nackademin
 
JavaScript patterns chapter 8 of mine
JavaScript patterns chapter 8 of mineJavaScript patterns chapter 8 of mine
JavaScript patterns chapter 8 of mine
 
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
Microservices in Go_Dessi_Massimiliano_Codemotion_2017_Rome
 

Recently uploaded

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
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
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Recently uploaded (20)

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
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
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
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
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 

Js events

  • 1. JavaScript: Event Model November 1, 2005 Slides modified from Internet & World Wide Web: How to Program. 2004 (3rd) edition. By Deitel, Deitel, and Goldberg. Published by Prentice Hall. ISBN 0-13-145091-3 1
  • 2. Chapter 14 – Dynamic HTML: Event Model Outline 14.1 Introduction 14.2 Event onclick 14.3 Event onload 14.4 Error Handling with onerror 14.5 Tracking the Mouse with Event onmousemove 14.6 Rollovers with onmouseover and onmouseout 14.7 Form Processing with onfocus and onblur 14.8 More Form Processing with onsubmit and onreset 14.9 Event Bubbling 14.10 More DHTML Events 14.11 Web Resources 2
  • 3. Objectives • In this lesson, you will learn: – To understand the notion of events, event handlers and event bubbling. – To be able to create event handlers that respond to mouse and keyboard events. – To be able to use the event object to be made aware of and, ultimately, respond to user actions. – To understand how to recognize and respond to the most popular events. 3
  • 4. 14.1 Introduction • Event model – Scripts can respond to user – Content becomes more dynamic – Interfaces become more intuitive 4
  • 5. Three different event models: • Internet Explorer – http://msdn.microsoft.com/workshop/author/om/event_model.asp • Gecko (Firefox, Netscape, Mozilla) – http://mozref.com/reference/specifications/DOM2Events • W3C – http://www.w3.org/TR/DOM-Level-2-Events/events.html • Reconciliations – http://www.oreillynet.com/pub/a/javascript/synd/2001/09/25/even t_models.html?page=2 – http://www.javascriptkit.com/dhtmltutors/domevent1.shtml – Event object: http://www.javascriptkit.com/jsref/event.shtml 5
  • 6. 14.2 Event onclick • onClick – Invoked when user clicks the mouse on a specific item 6
  • 7. onclick.html (1 of 2) 7
  • 8. 14.3  Event onload  • onload event – Fires when an element finishes loading – Used in the body element – Initiates a script after the page loads into the  client 8
  • 9. onload.html (1 of 2) 26 </head> 27 28 <body onload = "startTimer()"> 29 30 <p>Seconds you have spent viewing this page so far: 31 <strong id = “soFar”>0</strong></p> 32 33 </body> 34 </html> 9
  • 10. 14.4  Error Handling with  onerror  • onerror event – Execute specialized error-handling code 10
  • 12. 14.5  Tracking the Mouse  with Event onmousemove  • onmousemove – Fires repeatedly when the user moves the  mouse over the Web page – Gives position of the mouse 12
  • 13. onmousemove.html (2 of 2) 13
  • 14. 14.6  Rollovers with  onmouseover and onmouseout  • Two more events fired by mouse  movements – onmouseover • Mouse cursor moves over element – Onmouseout • Mouse cursor leaves element 14
  • 15. 15
  • 16. 16
  • 17. 14.7  Form Processing with  onfocus and onblur  • onfocus event fires when element gains  focus • onblur event fires when element loses  focus 17
  • 18. onfocusblur.html (2 of 3) 18
  • 19. 14.8  More Form Processing  with onsubmit and onreset  • onsubmit and onreset are useful events  for processing forms 19
  • 20. 1 <?xml version = "1.0"?> 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 4 5 <!-- Fig 14.8: onsubmitreset.html --> 6 <!-- Demonstrating the onsubmit and onreset events --> 7 8 <html xmlns = "http://www.w3.org/1999/xhtml"> 9 <head> 10 <title> 11 12 13 </title> onsubmitreset.html DHTML Event Model - onsubmit and onreset events <script type = "text/javascript"> 14 15 <!-- var helpArray = (1 of 4) 16 [ "Enter your name in this input box.", 17 "Enter your email address in this input box, " + 18 "in the format user@domain.", 19 "Check this box if you liked our site.", 20 "In this box, enter any comments you would " + 21 "like us to read.", 22 "This button submits the form to the " + 23 "server-side script", 24 "This button clears the form", 25 "This textarea provides context-sensitive " + 20
  • 21. 35 function formSubmit() { 36 window.event.returnValue = false; 37 38 if ( confirm ( "Are you sure you want to submit?" ) ) 39 window.event.returnValue = true; 40 } 41 42 function formReset() { 43 window.event.returnValue = false; 44 45 46 onsubmitreset.html if ( confirm( "Are you sure you want to reset?" ) ) window.event.returnValue = true; (2 of 4) 47 } 48 // --> 49 </script> 50 </head> 51 52 <body> 53 54 <form id = "myForm" onsubmit = "formSubmit()" 55 onreset = "formReset()" action = ""> 56 Name: <input type = "text" name = "name" 57 onfocus = "helpText(0)" onblur = "helpText(6)" /><br /> 58 Email: <input type = "text" name = "email" 59 onfocus = "helpText(1)" onblur = "helpText(6)" /><br /> 60 Click here if you like this site 61 <input type = "checkbox" name = "like" onfocus = 62 "helpText(2)" onblur = "helpText(6)" /><hr /> 21 63
  • 22. 51 52 <body> 53 54 <form id = "myForm" onsubmit = "formSubmit()" 55 onreset = "formReset()" action = ""> 56 Name: <input type = "text" name = "name" 57 onfocus = "helpText(0)" onblur = "helpText(6)" /><br /> 58 Email: <input type = "text" name = "email" 59 onfocus = "helpText(1)" onblur = "helpText(6)" /><br /> 60 Click here if you like this site 61 62 63 onsubmitreset.html <input type = "checkbox" name = "like" onfocus = "helpText(2)" onblur = "helpText(6)" /><hr /> 64 65 66 Any comments?<br /> (3 of 4) <textarea name = "comments" rows = "5" cols = "45" onfocus = "helpText(3)" onblur = "helpText(6)"> 67 </textarea><br /> 68 <input type = "submit" value = "Submit" onfocus = 69 "helpText(4)" onblur = "helpText(6)" /> 70 <input type = "reset" value = "Reset" onfocus = 71 "helpText(5)" onblur = "helpText(6)" /> 72 73 <textarea name = "helpBox" style = "position: absolute; 74 right:0; top: 0" rows = "4" cols = "45"> 75 This textarea provides context-sensitive help. Click on 22
  • 23. 14.9 Event Bubbling • Crucial part of the event model • Process whereby events fired in child elements “bubble” up to their parent elements 23
  • 24. bubbling.html (2 of 2) 24
  • 25. 25
  • 26. 14.10 More DHTML Events • Remaining DHTML events and their descriptions • http://www.w3schools.com/jsref/jsref_events.asp 26