Page 117 - PortGPT_V2.1_C8_Flipbook
P. 117

Output:













                 Some of the HTML events and their event handlers are:

                         Event              Event Handler                            Description

                  click                onclick                    Mouse click on an element

                  mouseover            onmouseover                The mouse cursor moves over the element

                  mousemove            onmousemove                Any mouse movement takes place.
                  Submit               onsubmit                   The user submits the form



                        USING FUNCTIONS FOR EVENT HANDLING


                 A function specified in a script can be called by an event handler defined in HTML. For example:

                 <html>
                 <head>

                 <h1> Event Handling </h1>
                 </head>
                 <body>
                 <script language="Javascript">

                     function display()
                     {
                       alert("You are moving the mouse!");
                     }

                 </script>
                 <p onmouseover="display()"> Keep the mouse cursor over me and see the
                 magic!</p>
                 </body>

                 </html>













                                                                                      Introduction to Event Handling  115
   112   113   114   115   116   117   118   119   120   121   122