HTML <input> Tag with 'type=image'
<form name="myForm" action="http://www.htmlcodes.ws/resources/html-forms-action.cfm">
<input type="image" src="http://www.htmlcodes.ws/images/examples/australia-nz-map.gif" alt="Australia & NZ Map" name="myImageField">
</form>
The above example demonstrates usage of the <input>
element with the type
attribute set to image
(i.e. type="image"
).
The image
value represents either an image from which a user can select a coordinate and submit the form, or alternatively a button from which the user can submit the form. The element is a button, specifically a submit button.
You can use the src
attribute to provide the URL of an image. If you don't provide this, the field will appear as a button instead. In either case, you must provide the alt
attribute with a descriptive value. If you provide the src
attribute, the alt
attribute's value will be used whenever the image can't be displayed (eg, if the user's browser has images disabled, they're using a speech reader, etc). If you don't provide the src
attribute, the button's label will be the value provided by the alt
attribute.
<form name="myForm2" action="http://www.htmlcodes.ws/resources/html-forms-action.cfm">
<input type="image" alt="Australia or New Zealand" name="myImageField2">
</form>