HTML and CSS Reference
In-Depth Information
EXAMPLE
11.9 (
CONTINUED
)
3
<input type="image" name="submitbutton" src="submit.gif"
alt="submit"
/>
<br />
4
<input type="reset">
5
</form>
</div>
</big>
</body>
</html>
EXPLANATION
1
The HTML form starts here using the POST method to send the form input.
2
The input type is text. The user enters his or her name here.
3
The input type is a GIF image submit button. When the user clicks on the image,
the form will be submitted and sent to the CGI program assigned to the form's
ac-
tion
attribute. The
src
attribute is assigned the URL of the
submit.gif
image. If the
image can't be loaded, the
alt
attribute will cause the word “submit” to appear
where the image should go.
4
When the user clicks the Reset button (see Figure 11.17), the textbox will be
cleared.
5
The HTML form ends here.
Figure 11.17
An image as a submit button (IE).
Submitting a Form
with
JavaScript (Event Handlers).
A discussion of forms
would be incomplete without mentioning how JavaScript implements form events (see
Chapter 13 for a complete discussion). Events are triggered by a user when he or she
initiates some action, like pressing a key, clicking the mouse on a button, or moving the
mouse over a link. When such an action occurs, the browser detects it, and depending