Page 141 - iPrime_V2.2_class7
P. 141
Adding Text Box
A text box allows a user to enter data such as character and number.
To add the text box in a form, follow the syntax below:
<INPUT TYPE="TEXT" NAME="Name of the textbox" SIZE="size of the textbox"
VALUE="default value of textbox">
For example:
<INPUT TYPE="TEXT" NAME="EName1" SIZE="30" VALUE="Enter User Name">
TYPE="Text" indicates that the form element is text box.
NAME="EName1" is the name of the text box.
VALUE="Enter User Name" is the default value of text box.
Let us create a web page to display the text box.
<!DOCTYPE html>
<HTML>
<BODY>
<FORM>
USER NAME:
<INPUT TYPE="TEXT"
NAME="EName1"
SIZE="30"
VALUE="Enter User Name">
</FORM>
</BODY>
</HTML>
Adding a Radio Button
Radio buttons are used when a user has to make a selection among multiple choices or options.
It is generally used for selection of gender, quiz questions, etc. For example, to accept the gender,
the programmer needs to create 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. To add the radio button to the form, follow the syntax as given
below:
<INPUT TYPE="RADIO" NAME="Name of the radio button" VALUE="value of radio
button" CHECKED>
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 a radio button.
NAME="Gender" is the name of the radio button group.
VALUE="Male" and VALUE="Female" signifies that one radio button has a value "Male" and the
other has the value="Female".
More on HTML 139

