HTML and CSS Reference
<input type="submit" value="Log In">
Figure 8-16 shows the rendered form. As you know by now, form elements may look different in other
browsers and on other operating systems, and that's especially true of buttons (this image is from Internet
Explorer on Windows 7).
Figure 8-16 . The input element's value attribute specifies the button's text label
This control generates a button that, when clicked, resets the entire form, blanking out any data the user
has entered and setting all controls back to their initial values. Reset buttons were much more common in
the past, but a few years of practical use has shown them to rarely be of much value. It's far too likely that
a user will accidentally reset the form and irretrievably lose all the information he's carefully entered—
especially frustrating when there's no mechanism to undo such a mistake. These days reset buttons are
generally discouraged; if you decide to use one, do so with care and only when it can actually help people
use your forms.
As with a submit button, the reset button's value attribute determines the button's text label, usually
defaulting to “Reset” if the attribute is missing.
A button input is just that: a generic button. It has no inherent function; it merely serves as a clickable
widget that can trigger a client-side script. You can set the button's text via the value attribute, or it
typically defaults to “Button” if you don't provide a value. Instead of embedding these scripted buttons in
function without a client-side script to imbue it with purpose, and a control that only works with a script
needn't be displayed if the script isn't available.
An image control behaves essentially like a submit button: activating the control will submit the form. But
an input type="image" allows you to substitute the standard button with a more decorative graphic. As
with other images in HTML, an image input requires a src attribute to specify the image file's URL and an
alt attribute to provide an alternative text description when the image isn't available (see Chapter 5 for
more about the src and alt attributes). Alternative text is especially vital for image form controls, to
ensure that the form can be successfully completed even when the image can't be seen. Without a useful
alt attribute, people using text browsers or screen readers will have difficulty identifying the button,