The Radio Button Widget
Try it out...check one then check another.
Behind the scenes, the above radio buttons were created with the following HTML code
<FORM>
<INPUT TYPE = "RADIO" NAME = "radio">
<INPUT TYPE = "RADIO" NAME = "radio">
<INPUT TYPE = "RADIO" NAME = "radio">
</FORM>
| Attribute | Description |
|---|---|
| TYPE | Specifies the type of interface widget. For a radio button widget, you use "RADIO" |
| NAME | Specifies the variable name associated with this widget |
| VALUE | Specifies the VALUE that will be sent in the URL-encoded string if the radio button is checked. If it is not checked, neither the name nor the value will be part of the URL-encoded string. |
| CHECKED | Specifies that the radio button will be checked by default. It is recommended that you check one (but never more than one) option by default. |
The NAME and VALUE attributes
Here is the code that we used to make them.
<FORM>
<TABLE BORDER = "1">
<TR>
<TD>Apples</TD>
<TD><INPUT TYPE = "RADIO"
NAME = "fruit"
VALUE = "apples"></TD>
</TR>
<TR>
<TD>Oranges</TD>
<TD><INPUT TYPE = "RADIO"
NAME = "fruit"
VALUE= "oranges"></TD>
</TR>
<TR>
<TD>Pears</TD>
<TD><INPUT TYPE = "RADIO"
NAME = "fruit"
VALUE= "pears"></TD>
</TR>
</TABLE>
</FORM>
fruit=apples
The CHECKED Attribute
And here is the code that we used to make that radio group.
<FORM>
<TABLE BORDER = "1">
<TR>
<TD>Download JDK 1.1.4 for Java</TD>
<TD><INPUT TYPE = "RADIO"
NAME = "java_kit"
VALUE= "jdk_114"
>
</TD>
</TR>
<TR>
<TD>Download JDK 1.0.2 for Java</TD>
<TD><INPUT TYPE = "RADIO"
NAME = "java_kit"
VALUE= "jdk_102"
>
</TD>
</TR>
<TR>
<TD>Download the AFC for Java</TD>
<TD><INPUT TYPE = "RADIO"
NAME = "java_kit"
VALUE= "afc" CHECKED>
</TD>
</TR>
</TABLE>
</FORM>