HTML and CSS Reference
The events, in their simplest form, are tied to HTML. In the following example, an
HTML form is created with the <form> tag and its attributes. Along with the type and
HTML <form> tag. The type of input device is called a button and the value assigned to
the button is “Pinch me” . When the user clicks the button in the browser window, a Java-
Script event, called click , will be triggered. The onClick event handler is assigned a value
that is the command that will be executed after the button has been clicked. In our
example, it will result in an alert box popping up in its own little window, displaying
“ OUCH!! ”. See the output of Example 1.2 in Figures 1.6 and 1.7.
<input type ="button"
value = "Pinch me"
Figure 1.6 User initiates a click event when he or she clicks the mouse on the button.
Figure 1.7 The onClick event handler is triggered when the button labeled “Pinch me” is