HTML and CSS Reference
In-Depth Information
Image buttons behave much like mouse-sensitive image maps ( usemap ),
and like the programs or client-side <map> tags that process image maps,
your forms processor may use the X,Y mouse-pointer parameters to
choose a special course of action. You should use an image button when
you need the additional form information to process the user's request.
If an image map of links is all you need, use a mouse-sensitive image
map. Mouse-sensitive images also have the added benefit of provid-
ing server-side support for automatic detection of shape selection within
the image, letting you deal with the image as a selectable collection of
shapes. Form buttons with images require you to write code that de-
termines where the user clicked on the image and how the server can
translate this position to an appropriate action.
Oddly, the HTML 4 and XHTML standards allow the use of the usemap
attribute with an image button, but do not explain how such a use
might conflict with normal server processing of the X,Y coordinates of
the mouse position. We recommend not mixing the two, using mouse-
sensitive images outside of forms and image buttons within forms. Push buttons
Using the <input type=button> tag (or the <button> tag, described later
in this chapter, in section 9.6), you create a button that the user may
click, but that does not submit or reset the form. Use the value attribute
to set the label on the button. The name attribute, if included in the tag,
causes the supplied value to be passed to the forms-processing script.
You might wonder what value the button type provides: little or none,
unless you supply one or more of the on -event attributes along with
a snippet of JavaScript to be executed when the user interacts with
the button. Thus empowered, these buttons provide a way for the user
to initiate form content validation, update fields, manipulate the doc-
ument, and perform all other kinds of client-side activity. [ JavaScript
Event Handlers, 12.3.3 ]
Search WWH ::

Custom Search