Page 146 - CA_165_V2.0_Flipbook
P. 146
input.html
</TITLE>
</HEAD>
<BODY>
<FORM>
USER NAME:
<INPUT TYPE = "TEXT" NAME ="ENAME1" SIZE = "30" >
</FORM>
</BODY>
</HTML>
The output of the preceding HTML code is as follows:
Text Box for
User Input
Adding a Radio Button
Radio buttons are used when the user has to make a selection among multiple choices or options. It is
generally used for the selection of gender, quiz questions, etc. For example, to accept the gender, the
programmer needs to specify two radio buttons "Male" and "Female", which belong to the same group
called "Gender" so that while inputting data a user will be able to select either "Male" or "Female" but not
both. For example:
<INPUT TYPE= "RADIO" NAME="Gender" VALUE="Male" CHECKED> Male
<INPUT TYPE="RADIO" NAME="Gender" VALUE="Female"> Female
TYPE="RADIO" indicates that the form element is radio button.
NAME="Gender" is the name of the radio button group.
VALUE="Male" and VALUE="Female" signifies that one radio button has value "Male" and the other has
the value "Female".
CHECKED attribute selects the specific radio button by default. Here, ‘Male’ radio button is checked by
default.
The following HTML code uses the <INPUT> tag with the TYPE, NAME, and VALUE attributes to create
radio buttons for selecting gender.
<HTML>
<HEAD>
<TITLE>
ADDING A RADIO BUTTON
144 Touchpad Computer Applications-X

