HTML and CSS Reference
In-Depth Information
Figure 9.7
Use a check box
when one or more
selections is
appropriate
The XHTML code follows:
Choose the browsers you use:<br />
<input type="checkbox" name="IE" id="IE" value="yes" />
Internet Explorer<br />
<input type="checkbox" name="Firefox" id="Firefox" value="yes" />
Netscape<br />
<input type="checkbox" name="Opera" id="Opera" value="yes" /> Opera
Note that the value of all the check boxes just happened to be yes . You can set the
value to be any meaningful word or phrase. The name of each check box should be
unique.
Common check box attributes are listed in Table 9.4.
Table 9.4 Common check box attributes
Attribute
Values
Usage
Configures the check box.
type
checkbox
Alphanumeric, no spaces,
begins with a letter
Names the form element so that it can be easily accessed by client-
side scripting languages or by server-side processing. The name of
each check box should be unique.
name
Alphanumeric, no spaces,
begins with a letter
Provides a unique identifier for the form element.
id
Configures the check box to be checked by default when displayed
by the browser.
checked
checked
Text or numeric characters
Assigns a value to the check box that is triggered when the check
box is checked. This value can be accessed by client-side and by
server-side processing.
value
Radio Button. The <input /> tag configures this form control. Radio buttons allow
the user to select exactly one item from a group of predetermined items. Each radio
button in a group is given the same name and a unique value. Because the name is the
same, the elements are identified as part of a group and only one may be selected. A
sample radio button group is shown in Figure 9.8.
Figure 9.8
Use radio buttons
when only one
choice is an
appropriate response
 
Search WWH ::




Custom Search