If the value of the type attribute is “text” i.e. <input type= “Text”>, the form will show a textbox. This textbox accepts the input in one line.
Along with this the TextBox field accepts value, size, name, maxlength, align and tabindex within the <input> tag.
Attributes of Text Field |
Description |
Size |
It defines the width of the field. It contains no. of visible characters. |
Maxlength |
It defines the maximum length of the field. It contains maximum no. of characters that can be entered in the field. |
Name |
It adds an internal name to the field so the program that handles the form can identify the fields. |
Align |
It defines how the text field will be aligned on the form. Valid entries are: TOP, MIDDLE, BOTTOM, RIGHT, LEFT, TEXTTOP, BASELINE, ABSMIDDLE, ABSBOTTOM. |
Tabindex |
It defines in which order the different fields should be activated when the visitor clicks the tab key. |
For Example :
Two textboxes whose internal name (computer can understand the internal name) is “Fname” and “Mname” are created using the value “text” for the type attribute. The internal name is different from the label.
HTML Code :
<form>
Father’s Name:
<input type=”text” size = “20” name=”FName” >
<br>
Mother’s name:
<input type=”text” size = “20” name=”MName”>
</form>
The above code creates two textboxes, each of which is 20 characters wide. The two textboxes are arranged vertically one below the other. The <br> tag does the work of Enter key.
Output :
