HTML and CSS Reference
In-Depth Information
EXAM TIP
Anything can be a “button.” Because most DOM elements have a click event or at least
a mousedown and mouseup event, the concept of clicking can be captured and custom
actions processed. This can inherently turn any part of the DOM into a ”button.”
The submit input type tells the HTML form to post its information to the server (or, in some
cases, to another site or webpage). The reset type automatically clears all form elements to
their default values. The button type provides a generic button with no predefined func-
tionality. It can be used to provide a custom function, such as cancel out from this page and
return to the home page. All three button types are added to the bottom of the survey page
as follows:
<tr>
<td>
<input type="submit"/>
<input type="reset"/>
<input type="button"/>
</td>
</tr>
That's all that's required to add the functionality to the page for each button. Of course,
type=”button” requires some JavaScript to be wired up to actually do something. However,
the submit and reset buttons come with the described functionality built in. The HTML
provides the output on the form as shown in Figure 3-12.
FIGURE 3-12 Buttons added to the HTML form
 
 
Search WWH ::




Custom Search