ptg16476052
Creating Form Controls with the <input> Tag 337
12
Using Images as Submit Buttons
Using image as the type of input control enab les you to use an image as a Submit but-
ton:
Input ▼
Figure 12.14 shows a custom button created with an image.
Output ▼
When the user clicks an image field, the x and y coordinates of the point where the user
clicked are submitted to the server. The data is submitted as name.x = x coord and
name.y = y coord, where name is the name assigned to the control. Using the preceding
code, the result might look like the following:
submitoformbtn.x=150&submitformbtn.y=200
You can omit the name if you choose. If you do so, the coordinates returned would just
be x = and y =. Form controls with the type image support all the attributes of the
tag. You can also use the same CSS properties you would use with tags to modify
the appearance and spacing of the button. To refresh your memory on the attributes sup-
ported by the tag, go back to Lesson 9, “Using Images on Your Web Pages .”
Creating Generic Buttons............................................................................
In addition to creating Submit, Reset, and Image buttons, you can create buttons that
generate events within the browser that can be tied to client-side scripts. To create such a
FIGURE 12.14
The image input
type.