Forms: HTML
Create Radio Buttons
| Create a Form | Remember that you create a form field with
the <FORM></FORM> tag pair.
Within the <FORM> tags will go the entire form, i.e. both the questions you ask and the form elements, i.e., the box and button spaces where the user will supply responses |
|
| To create most form elements, use the following code: | ||
| <INPUT TYPE="[form]" NAME="[name]"> | ||
This tag does not require
a closing tag
|
||
| The Radio Button | The radio button is a form
element that allows the user to select only one of a number of offered
choices.
The term for this form element refers to the fact that you can choose to press only one button (i.e., listen to only one station) at a time on a car radio. The radio button tag requires a VALUE for each possible choice. VALUE refers to the actual data being collected. The VALUE attribute identifies the information gathered when a user specifies a particular choice from a list provided by you. |
|
| Example | ||
| The HTML code used to create a radio button is : | ||
| <INPUT TYPE="radio" NAME="[radioset]" VALUE="[value]"> | ||
| [radioset]
equals a name given to the entire set of radio button choices
in a particular question.
[value] equals the name of each button in the radioset. Repeat the radio button tag for each button in the radioset. Use the same radioset NAME for each button but change the VALUE attribute to reflect the content of the particular button. You can add the CHECKED attribute to one of the tags if you want a popular button to be pre-checked. |
||
| The HTML code for the sample radioset above is: | ||
|
In what county do you live? <BR> <INPUT TYPE="radio" NAME="county" VALUE="arlington">Arlington <INPUT TYPE="radio" NAME="county" VALUE="fairfax">Fairfax <INPUT TYPE="radio" NAME="county" VALUE="loudoun">Loudoun <INPUT TYPE="radio" NAME="county" VALUE="prwill">Prince William |
||
| Remember that this code goes within the <FORM></FORM> tag pair | ||
| Note that I called the radioset
county.
Note also that I attached a value to each button that reflected the information it displays. |
||
Forms: HTML
Overview
Create a Form
Create Text and Password Boxes
Create Radio Buttons
Create Checkboxes
Create Menu Boxes
Create Text Blocks
Create the Reset and Submit Buttons
Web Design Center
Last Revised:
October 19, 2006
© Agatha Taormina