Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 117 - 2625 PortGPt V2.1
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 |