jim.shamlin.com

Image

A bit of disambiguation: in this document, I am referring to the button form element (<input type="image">) rather than the HTML image object (<IMG>).


Basics

Bare-bones code for an image is:

<INPUT TYPE="image" SRC="image.gif">

Usage

I can't see a good use for an image input type. I've seen them used as a quick and dirty way to create a "pretty" submit button for a form and as a method for a user to indicate a location on a map graphic as part of a form, but it seems to me there are better ways to do either of those things.


Processing

An image input type passes two name=value pairs to the server: name.x and name.y - with "name" being the NAME attribute of the input element and x and y being the coordinates at which the user clicked (starting at 0,0 in the top left).


HTML Attributes

Typical

Unusual


JavaScript

The image input type has a blend of attributes - combining the attributes of an <IMG>> and an <INPUT>>

Properties

Methods

Event Handlers


Misc Notes

I've never used an image as an input element, and cannot think of a reason someone might do so. They are more difficult to code than client-side image maps (which are a pain to do, but easier than this) and are not accessible to the disabled. I'm sure someone has found them to be invaluable for some specific purpose ... but I can't imagine what it might be.