Using an Image to Submit Data

You may use an image—called an active image—as a combination input element and submit button. In addition to submitting the data from the other fields in the form, a click on the image sends the current mouse coordinates to the server in two name-value pairs.

To use an image to submit data:

1.
Create a GIF or JPEG image.
2.
Type <input type="image".
3.
Type src="image.url", where image.url is the location of the image on the server.
4.
Type name="label", where label will be appended by x and y and will identify the x and y coordinates sent to the server, when the visitor clicks the image.
5.
Type alt="description", where description will appear if the image does not.
6.
Type the final /> to finish the active image ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.