HTML and CSS Reference
In-Depth Information
To Add Radio Buttons
Table 6-7 contains the HTML code to add a set of radio buttons to the Web page form.
Table 6-7 HTML Code to Add Radio Buttons
HTML Tag and Text
<p>Where do you make most of your music purchases:
<br /><input name="purchases" type="radio" value="none" />Don't buy music &nbsp;
<input name="purchases" type="radio" value="itunes" />iTunes &nbsp;
<input name="purchases" type="radio" value="amazon" />Amazon &nbsp;
<input name="purchases" type="radio" value="online" />Other online store &nbsp;
<input name="purchases" type="radio" value="retail" />Retail store &nbsp;
The following step adds three sets of radio buttons to the form.
Check that the insertion point is on
Line 31, and indented one Tab stop.
Enter the HTML code shown in
Table 6-7 and then press the e n t e r
key twice (Figure 6-12).
Could I have used check boxes
for this control, rather than radio
You could have used check boxes,
but it would not make sense for this
information. In this case, a single
option is appropriate, one choice
as the user's favorite. When you
use check boxes in a form, users
will assume that they can make
multiple selections. Make a point of
becoming familiar with the user interface standards used in most Web development.
insertion point
on line 39 and
tabbed once
five radio buttons
added to form
input control
type set to
radio button
Figure 6-12
Adding a Selection Menu
A select control is used to create a selection menu from which the visitor selects one
or more choices. A select control is suitable when a limited number of choices are available.
Figure 6-13 on the next page shows the basic selection menu used in the form, with four
Internet radio stations (Google, Live 365, Pandora, and Slacker) as the choices in the list.
Because this is a short list (four items), you could have used radio buttons for the same pur-
pose. Selection menus are often used in lieu of check boxes because of limited “real estate”
(or space) on the Web page. Selection boxes are often used for credit card information
because there is a limited number of credit card networks. The topic of accepting credit
cards via online forms is a serious one. See BTW on this page for more information.
Security is an important
issue to understand,
especially when you are
collecting credit card
information. Search
the Web for specific
information concerning
the usage of the SSL-
encrypted HTTPS protocol
versus the unencrypted
HTTP protocol.
Search WWH ::

Custom Search