HTML <input> Tag with the 'alt' Attribute

<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 alt attribute when using the <input> element.

When using an <input> element with type="image", the input control 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. In either case, the alt attribute must be included.

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.

Here's another example, but this time no src attribute has been provided. Therefore the control will appear as a button, with the value of the alt attribute appearing as its label.

<form name="myForm2" action="http://www.htmlcodes.ws/resources/html-forms-action.cfm">

<input type="image" alt="Australia or New Zealand" name="myImageField2">

</form>