Page 266 - Web_Application_v2.0_C12_Fb
P. 266

Output:















              Example 74: To demonstrate the use of  onkeydown event

                  <!DOCTYPE HTML>
                  <HTML>
                  <HEAD>
                  <TITLE>JavaScript onkeydown</TITLE>
                  </HEAD>
                  <SCRIPT>
                  function keyPressed() {
                  alert("Key pressed!");

                  }
                  </SCRIPT>
                  </HEAD>
                  <BODY>
                  <input type="text" onkeydown="keyPressed()" placeholder="Type something">
                  </BODY>
                  </HTML>
              Output:
















                                                                                           21 st  Century   #Media Literacy
                                                                                               Skills
                          Video Session

                     Watch  the  video  to  write  more  event  driven  programming  programs:  "How  to  write  Event  -  Driven
                     JavaScript program?'' at the given link:
                     https://www.youtube.com/watch?v=9tA5RY3g54I or scan the QR code  and  answer the
                     following question:
                     What is the purpose of the onclick event in JavaScript?






                264   Touchpad Web Applications (Ver. 2.0)-XII
   261   262   263   264   265   266   267   268   269   270   271