SlideShare a Scribd company logo
1 of 10
JavaScript Document Object :
       ondblclick (Event handler)
Description
The ondblclick event handler of a document
  object executes some JavaScript code or
  function when the pointing device (for
  example mouse) button is double clicked over
  the document object.
EXAMPLE                  BROWSER’S OUTPUT
<HTML>
<body
  bottommargin=150
  ondblclick="alert('d
  ouble clicked!')">
  <p>Double-click
  anywhere in the
  page.</p>
</body>
</HTML>
Keyboard Events:
The onkeydown event occurs when the user is pressing a key (on the
   keyboard).
Tip: The order of events related to the onkeydown event:
   a. onkeydown--A key is pressed down.
   b. onkeypress --A character key is pressed
   c. onkeyup-- A key is released.

There is a fundamental difference between keypress and keydown.

Keydown ------triggers on any key press and gives scan-code.
Keypress ------triggers after key down and gives char-code, but it is
guaranteed for character keys only.
<html><head>        EXAMPLE            BROWSER’S OUTPUT
<script>
function myFunction()
{
alert("You pressed a key inside the
   input field");
}
</script>
</head>
<body>
<p>A function is triggered when
   the user is pressing a key in the
   input field.</p>
<input type="text"
   onkeydown="myFunction()">
</body>
</html>
MOUSE EVENTS
The onmousedown event occurs when a user presses a
  mouse button over an element.
Tip: The order of events related to the onmousedown
  event (for the left/middle mouse button):
onmousedown
onmouseup
onclick
The order of events related to the onmousedown event
  (for the right mouse button):
onmousedown
onmouseup
oncontextmenu
EXAMPLE                 BROWSER’S OUTPUT
<html><head>
<script>
function myFunction(elmnt,clr)
{
elmnt.style.color=clr;
}
</script>
                                                On this example, when
</head><body>                                   the text was click it was
<p onmousedown="myFunction(this,'red')"         change to green, but
onmouseup="myFunction(this,'green')">           when mouse button was
Click the text to change the color. A           pressed down it was
                                                change to red, when the
function, with parameters, is triggered when
                                                mouse button was
the mouse button is pressed down, and           released or press up it
again, with other parameters, when the          returns to green.
mouse button is released.
</p>
</body></html>
Form onreset and onsubmit Event


• The onreset event occurs when
  the reset button in a form is clicked.
• The onsubmit event occurs when
  the submit button in a form is
  clicked.
EXAMPLE    BROWSER’S OUTPUT
<html><body>
<p>Enter some text in the fields
   below, then press the Reset
   button to reset the form.</p>
<form onreset="alert('The form
   will be reset')">
Firstname: <input type="text"
   name="fname"
   value="Donald"><br>
Lastname: <input type="text"
   name="lname" value="Duck">
<br><br>
<input type="reset"
   value="Reset">
</form>
</body></html
EXAMPLE
<html><head><script>         <body>
function greeting()          What is your name?<br>
                             <form name="frm1"
{
                             action="tryjsref_form_onsubmit.ht
alert("Welcome " +           m" onsubmit="greeting()">
   document.forms["frm1"     <input type="text"
   ]["fname"].value + "!")   name="fname">
}                            <input type="submit"
</script>                    value="Submit">
                             </form>
</head>
                             </body>
    BROWSER’S OUTPUT         </html>

More Related Content

What's hot (13)

How to setting e mail signatures
How to setting e mail signaturesHow to setting e mail signatures
How to setting e mail signatures
 
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
 
1
11
1
 
Google Chrome tips and tricks
Google Chrome tips and tricksGoogle Chrome tips and tricks
Google Chrome tips and tricks
 
How to send a big file using dropbox
How to send a big file using dropboxHow to send a big file using dropbox
How to send a big file using dropbox
 
Calculadora
CalculadoraCalculadora
Calculadora
 
Calculadora
CalculadoraCalculadora
Calculadora
 
Web Presentations, deck.js and Extensions
Web Presentations, deck.js and ExtensionsWeb Presentations, deck.js and Extensions
Web Presentations, deck.js and Extensions
 
keyboard shortcut for windows remote desktop
keyboard shortcut for windows remote desktopkeyboard shortcut for windows remote desktop
keyboard shortcut for windows remote desktop
 
Microsoft windows command prompt
Microsoft windows command promptMicrosoft windows command prompt
Microsoft windows command prompt
 
52 100 keyboard_shortcuts
52 100 keyboard_shortcuts52 100 keyboard_shortcuts
52 100 keyboard_shortcuts
 
Cara cepat pakai keyboard
Cara cepat pakai keyboardCara cepat pakai keyboard
Cara cepat pakai keyboard
 

Viewers also liked

Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
sotlsoc
 
Css color and background properties
Css color and background propertiesCss color and background properties
Css color and background properties
Jesus Obenita Jr.
 
Unit iii css and javascript 1
Unit iii css and javascript 1Unit iii css and javascript 1
Unit iii css and javascript 1
Jesus Obenita Jr.
 
Javascript alert and confrim box
Javascript alert and confrim boxJavascript alert and confrim box
Javascript alert and confrim box
Jesus Obenita Jr.
 
JavaScript-Events_CertificateOfCompletion
JavaScript-Events_CertificateOfCompletionJavaScript-Events_CertificateOfCompletion
JavaScript-Events_CertificateOfCompletion
Sandip Das
 

Viewers also liked (20)

Asp.net event handler
Asp.net event handlerAsp.net event handler
Asp.net event handler
 
Chapter 11.5
Chapter 11.5Chapter 11.5
Chapter 11.5
 
Powerpoint
PowerpointPowerpoint
Powerpoint
 
Css color and background properties
Css color and background propertiesCss color and background properties
Css color and background properties
 
Microsoft word
Microsoft wordMicrosoft word
Microsoft word
 
Unit iii css and javascript 1
Unit iii css and javascript 1Unit iii css and javascript 1
Unit iii css and javascript 1
 
Designing static pages using html formatting text
Designing static pages using html  formatting textDesigning static pages using html  formatting text
Designing static pages using html formatting text
 
Greek God and Goddesses
Greek God and GoddessesGreek God and Goddesses
Greek God and Goddesses
 
Microsoft PowerPoint
Microsoft PowerPointMicrosoft PowerPoint
Microsoft PowerPoint
 
Java scriptfunction
Java scriptfunctionJava scriptfunction
Java scriptfunction
 
Designing web pages html videos
Designing web pages html videosDesigning web pages html videos
Designing web pages html videos
 
Javascript alert and confrim box
Javascript alert and confrim boxJavascript alert and confrim box
Javascript alert and confrim box
 
Word 2013 working with pictures
Word 2013 working with picturesWord 2013 working with pictures
Word 2013 working with pictures
 
JavaScript-Events_CertificateOfCompletion
JavaScript-Events_CertificateOfCompletionJavaScript-Events_CertificateOfCompletion
JavaScript-Events_CertificateOfCompletion
 
Chapter iv computer virus
Chapter iv  computer virusChapter iv  computer virus
Chapter iv computer virus
 
Html web designing linking pages
Html web designing linking pagesHtml web designing linking pages
Html web designing linking pages
 
Javascript validating form
Javascript validating formJavascript validating form
Javascript validating form
 
Ms excel 2013 data management
Ms excel 2013 data managementMs excel 2013 data management
Ms excel 2013 data management
 
EKONOMIKS
EKONOMIKSEKONOMIKS
EKONOMIKS
 
Understanding the basics of web design 3pptx
Understanding the basics of web design 3pptxUnderstanding the basics of web design 3pptx
Understanding the basics of web design 3pptx
 

Similar to Javascript event handler 2

Similar to Javascript event handler 2 (20)

Web 5 | JavaScript Events
Web 5 | JavaScript EventsWeb 5 | JavaScript Events
Web 5 | JavaScript Events
 
JavaScript-L20.pptx
JavaScript-L20.pptxJavaScript-L20.pptx
JavaScript-L20.pptx
 
Html tag
Html tagHtml tag
Html tag
 
Java script programms
Java script programmsJava script programms
Java script programms
 
Java script errors &amp; exceptions handling
Java script  errors &amp; exceptions handlingJava script  errors &amp; exceptions handling
Java script errors &amp; exceptions handling
 
Java script events
Java script  eventsJava script  events
Java script events
 
DHTML - Events & Buttons
DHTML - Events  & ButtonsDHTML - Events  & Buttons
DHTML - Events & Buttons
 
Events Lecture Notes
Events Lecture NotesEvents Lecture Notes
Events Lecture Notes
 
course js day 3
course js day 3course js day 3
course js day 3
 
Java Script
Java ScriptJava Script
Java Script
 
Un-Framework - Delivering Dynamic Experiences with HTML over the Wire
Un-Framework - Delivering Dynamic Experiences with HTML over the WireUn-Framework - Delivering Dynamic Experiences with HTML over the Wire
Un-Framework - Delivering Dynamic Experiences with HTML over the Wire
 
ReactJS
ReactJSReactJS
ReactJS
 
Yahoo presentation: JavaScript Events
Yahoo presentation: JavaScript EventsYahoo presentation: JavaScript Events
Yahoo presentation: JavaScript Events
 
Javascript event handler
Javascript event handlerJavascript event handler
Javascript event handler
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
 
20180921 #24 we_are_javascripters
20180921 #24 we_are_javascripters20180921 #24 we_are_javascripters
20180921 #24 we_are_javascripters
 
Event In JavaScript
Event In JavaScriptEvent In JavaScript
Event In JavaScript
 
Function calling in js
Function calling in jsFunction calling in js
Function calling in js
 
Dynamic HTML Event Model
Dynamic HTML Event ModelDynamic HTML Event Model
Dynamic HTML Event Model
 
4.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.15
4.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.154.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.15
4.7.14&amp;17.7.14&amp;23.6.15&amp;10.9.15
 

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
 
Microsoft Excel introduction
Microsoft Excel introductionMicrosoft Excel introduction
Microsoft Excel introduction
 
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
 
Computer software
Computer softwareComputer software
Computer software
 
Computer software
Computer softwareComputer software
Computer software
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

Javascript event handler 2

  • 1.
  • 2. JavaScript Document Object : ondblclick (Event handler) Description The ondblclick event handler of a document object executes some JavaScript code or function when the pointing device (for example mouse) button is double clicked over the document object.
  • 3. EXAMPLE BROWSER’S OUTPUT <HTML> <body bottommargin=150 ondblclick="alert('d ouble clicked!')"> <p>Double-click anywhere in the page.</p> </body> </HTML>
  • 4. Keyboard Events: The onkeydown event occurs when the user is pressing a key (on the keyboard). Tip: The order of events related to the onkeydown event: a. onkeydown--A key is pressed down. b. onkeypress --A character key is pressed c. onkeyup-- A key is released. There is a fundamental difference between keypress and keydown. Keydown ------triggers on any key press and gives scan-code. Keypress ------triggers after key down and gives char-code, but it is guaranteed for character keys only.
  • 5. <html><head> EXAMPLE BROWSER’S OUTPUT <script> function myFunction() { alert("You pressed a key inside the input field"); } </script> </head> <body> <p>A function is triggered when the user is pressing a key in the input field.</p> <input type="text" onkeydown="myFunction()"> </body> </html>
  • 6. MOUSE EVENTS The onmousedown event occurs when a user presses a mouse button over an element. Tip: The order of events related to the onmousedown event (for the left/middle mouse button): onmousedown onmouseup onclick The order of events related to the onmousedown event (for the right mouse button): onmousedown onmouseup oncontextmenu
  • 7. EXAMPLE BROWSER’S OUTPUT <html><head> <script> function myFunction(elmnt,clr) { elmnt.style.color=clr; } </script> On this example, when </head><body> the text was click it was <p onmousedown="myFunction(this,'red')" change to green, but onmouseup="myFunction(this,'green')"> when mouse button was Click the text to change the color. A pressed down it was change to red, when the function, with parameters, is triggered when mouse button was the mouse button is pressed down, and released or press up it again, with other parameters, when the returns to green. mouse button is released. </p> </body></html>
  • 8. Form onreset and onsubmit Event • The onreset event occurs when the reset button in a form is clicked. • The onsubmit event occurs when the submit button in a form is clicked.
  • 9. EXAMPLE BROWSER’S OUTPUT <html><body> <p>Enter some text in the fields below, then press the Reset button to reset the form.</p> <form onreset="alert('The form will be reset')"> Firstname: <input type="text" name="fname" value="Donald"><br> Lastname: <input type="text" name="lname" value="Duck"> <br><br> <input type="reset" value="Reset"> </form> </body></html
  • 10. EXAMPLE <html><head><script> <body> function greeting() What is your name?<br> <form name="frm1" { action="tryjsref_form_onsubmit.ht alert("Welcome " + m" onsubmit="greeting()"> document.forms["frm1" <input type="text" ]["fname"].value + "!") name="fname"> } <input type="submit" </script> value="Submit"> </form> </head> </body> BROWSER’S OUTPUT </html>