The Image Input Type
<Form Action="some URL">
Name: <Input name = "Name">
<Input type = image
alt = "Submit :-)"
src =
"http://Stars.com/Icons/smile.gif">
</Form>
Creates a graphical submit button.
The value of the
src
attribute specifies the URL of the image to act as the button.
As with regular images, you should provide
alternate
text to the image to allow access in cases where the image is not
displayed.
When a pointing device, e.g. mouse, is used to click on the image,
the form is submitted and the (x,y) location passed to the server.
The x value is measured in pixels from the left of the image,
and the y value in pixels from the top of the image.
The submitted data includes name.x=x-value
and name.y=y-value where "name" is the value
of the name attribute,
and
x-value and
y-value are the x and y coordinate values respectively.
It's unusual for the location of the click to be important, but if it
is, then you might want to consider alternative approaches to allow
easier access for those not using graphical browsers:
- Use multiple submit buttons (each with its own image)
in place of a single graphical submit button.
- Use
buttons in
HTML 4 (not widely supported yet by browsers).
- Use a
client-side image map
together with scripting.
See also
Image Input
in Selena Sol's
Introduction to Web Programming.
|