HTML <input> Tag with the 'alt' Attribute

<form name="myForm" action="">

<input type="image" src="" alt="Australia & NZ Map" name="myImageField">


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="">

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