<INPUT> Tag & its Attribute
HTML Tag <INPUT>
<INPUT> Identifies several input methods for forms. This tag must appear between the opening and closing <FORM> tags.
Attribute of <INPUT> Tag
- ACCEPT
- ALIGN
- CHECKED
- CLASS
- DATAFLD
- DATASRC
- DISABLED
- ID
- MAXLENGTH
- NAME
- NOTAB
- READONLY
- SIZE
- SRC
- STYLE
- TABINDEX
- TITLE
- TYPE
- USEMAP
- VALUE
ACCEPT
Specifies a list of acceptable MIME types for submitted files.
<INPUT TYPE=FILE ACCEPT="image/gif">
Please submit a GIF image.
Possible Values
File Type.
ALIGN
The behavior of this tag is identical to that of the ALIGN= attribute of the <IMG> tag.
<INPUT TYPE=IMAGE SRC="plogo.gif" ALIGN=RIGHT>
Possible Values
LEFT, CENTER, RIGHT
CHECKED
Use with TYPE=RADIO or TYPE=CHECKBOX to set the default state of those input methods to True.
<INPUT TYPE=CHECKBOX CHECKED
NAME="subject" VALUE="1"><BR>
2 <INPUT TYPE=CHECKBOX NAME="subject"
VALUE="2"><BR>
Possible Values
CHECKED
CLASS
Indicates which style class applies to the <INPUT> element.
<INPUT CLASS="dkm" TYPE=TEXT
NAME="age">
Possible Values
Any Class Name.
DATAFLD
Selects a column from previously identified tabular data.
<DIV DATASRC="#data_table">
<INPUT TYPE=TEXT NAME="color"
DATAFLD="colorvals">
Possible Values
Field Name.
DATASRC
Specifies the location of tabular data to be bound.
<INPUT TYPE=TEXT DATASRC="#data_table"
DATAFLD="dataval1">
Possible Values
DataSource
DISABLED
Disables an instance of the input method so that data cannot be accepted or submitted.
<INPUT TYPE=PASSWORD NAME="Pass"
DISABLED>
Possible Values
DISABLED
ID
Assigns a unique ID selector to an instance of the <INPUT> tag. When you then assign a style to that ID selector, it affects only that one instance of the <INPUT> tag.
Age:
<INPUT TYPE=TEXT NAME="age" ID="dkm">
Possible Values
Any ID Name.
MAXLENGTH
Indicates the number of characters you can enter into a text input field and is only useful to input methods of type TEXT or PASSWORD.
Phone: <INPUT TYPE=TEXT NAME="phone"
MAXLENGTH=11>
Possible Values
Any Integer Number.
NAME
Gives a name to the value you pass to the form processor.
Enter your phone number: <INPUT TYPE="text"
NAME="phone" SIZE=10>
Possible Values
Any Name.
NOTAB
Removes the input element from the tab order.
Hair color:
<INPUT TYPE=TEXT NAME="hcolor" NOTAB>
Possible Values
NOTAB
READONLY
Indicates that changes to the input method data cannot occur.
<INPUT TYPE=TEXT NAME="uid"
VALUE="1" READONLY>
Possible Values
READONLY
SIZE
Specifies the width of the input method (in characters).
Your Age: <INPUT TYPE="text" NAME="Age"
SIZE=5><BR>
Possible Values
Any integer number.
SRC
Implements a graphic image for a submit button. For this to work, indicate TYPE=IMAGE.
<INPUT TYPE=IMAGE SRC="/images/button,jpg">
Possible Values
URL
STYLE
Specifies Style Sheet commands that apply to the input element.
<INPUT TYPE=RADIO NAME="ok"
VALUE="ok" STYLE="background: red">
Possible Values
CSS Property with value.
TABINDEX
Specifies where the input method appears in the tab order. For example, TABINDEX=3 places the cursor at the input element after the visitor presses the Tab key three times.
Student Information:
<INPUT TYPE=TEXT NAME="Add"
TABINDEX=5>
Possible Values
Any Integer Number.
TITLE
Specifies text assigned to the tag. You might use this attribute for context-sensitive help within the document. Browsers may use this to show tool tips over the input method.
<INPUT TYPE=RADIO NAME="Gender"
VALUE="male" TITLE="Male">
Possible Values
Any Text Message.
TYPE
Indicates the kind of input method to use. Valid values are TEXT, PASSWORD, RADIO, CHECKBOX, SUBMIT, RESET, IMAGE, FILE, HIDDEN, and BUTTON.
Name: <INPUT TYPE=TEXT NAME="name"><BR>
Password: <INPUT TYPE=PASSWORD NAME="pass"><BR>
Possible Values
TEXT, PASSWORD, RADIO,CHECKBOX, SUBMIT, RESET, IMAGE, FILE, HIDDEN, BUTTON.
USEMAP
Indicates the relative or absolute location of a client-side image map to use with the form.
<INPUT SRC="mapimage.gif"
USEMAP="maps.html#map1">
Possible Values
URL
VALUE
Sets the default input value method. Required when <INPUT> is set to TYPE=RADIO or CHECKBOX.
<INPUT TYPE=HIDDEN NAME="id"
VALUE="e001">
Possible Values
Any Value.