Page 145 - CA_165_V2.0_Flipbook
P. 145
<FORM> Tag
Type Function Attributes Contains Used Inside
Container tag Defines a form ACTION, METHOD, Input fields, Typically placed within
for collecting NAME, TARGET, buttons, and the <BODY> tag.
user input and ENCTYPE ETC. other form-
sending it to a related elements
server. like <INPUT>,
<TEXTAREA>,
<SELECT>,
<BUTTON>, etc..
<INPUT> Tag
<INPUT> element is the fundamental element of form. It is used to make fields to take input data from
the user. We can create different input fields to gather various kinds of information from a user. Syntax to
use the <INPUT> tag is as follows:
<INPUT TYPE="TYPE" NAME="NAME" VALUE="VALUE" ALGIN="VALUE" SIZE="VALUE"
MAXLENGTH="VALUE">
<INPUT> Tag
Type Function Attributes Contains Used Inside
Empty tag Defines an TYPE, NAME, VALUE, None Typically placed within
input field for ALIGN, SIZE, and (self-closing). <FORM> or <BODY>
user data. MAXLENGTH. tag.
The <INPUT> tag has the following attributes:
TYPE The attribute specifies the type of form element, such as text, button, reset, submit, radio, etc.
NAME attribute is a name given to a form an element. This attribute is used to uniquely identify the
element in the form.
VALUE attribute is used to specify a default value to the control element.
ALIGN attribute is used for aligning the element with respect to the form margins.
SIZE attribute specifies the horizontal size of the text box.
MAXLENGTH attribute in HTML specifies the maximum number of characters allowed in an input
field.
Adding a Text Box
A text box allows a user to enter data such as any character and number.
The following HTML code uses the <INPUT> tag with the TYPE, NAME, and SIZE attributes to create a text
box where the user can enter a username with a size of 30 characters:
<HTML>
<HEAD>
<TITLE>
More About HTML 143

