HTML and CSS Reference
In-Depth Information
To link to the formßubmit.jß JavaScript program:
1. Return to the survey.htm file in your text editor.
2. Go to the head section of the document. Directly below the script element that
accesses the modernizr.js file, insert the following code, as shown in Figure 6-7:
<script src=”formsubmit.js”></script>
figure 6-7
linking to the formsubmit.js file
3. Save your changes to the file.
Now that you've added the form element to the survey page, you can start populat-
ing the survey form with control elements and other form features. You'll start by adding
field sets.
Creating a Field Set
A Web form like the survey form can have dozens of different fields. One way of orga-
nizing a form is to group similar fields into field sets . When rendered by a browser, a
field set is usually displayed with a box enclosing the fields in the set. Field sets are cre-
ated using the fieldset element
<fieldset id=” id ”>
controls
</fieldset>
where id identifies the field set and controls is the control elements associated with
fields within the field set. The id value is not required, but it is useful in distinguish-
ing one field set from another. Alice wants you to organize the form into two field sets
named custInfo and experience .
Creating a Field Set
• To create a field set, add the element
<fieldset id=” id ”>
controls
</fieldset>
to the form, where id identifies the field set and controls is the control elements
associated with fields within the field set.
• To add a legend to a field set, nest the element
<legend> text </legend>
within the fieldset element, where text is the text of the legend.
Search WWH ::




Custom Search