|
|
HTML <input> tag
Syntax
<input>
Definition and Usage
The INPUT element creates a variety of form input controls where the
users can enter data.
Optional Attributes
| Attribute |
Value |
Description |
| accept |
list_of_mime_types |
A comma-separated list of MIME types that indicates the
MIME type of the file transfer.
|
| align |
left
right
top
texttop
middle
absmiddle
baseline
bottom
absbottom |
Defines the alignment of text following the image.
|
| alt |
text |
Defines an alternate text for the image.
Note: Only used with type="image"
|
| checked |
checked |
Indicates that the input element should be checked when it
first loads.
Note: Used with type="checkbox" and
type="radio"
|
| disabled |
disabled |
Disables the input element when it first loads so that the
user can not write text in it, or select it.
Note: Cannot be used with type="hidden"
|
| maxlength |
number |
Defines the maximum number of characters allowed in a text
field.
Note: Only used with type="text"
|
| name |
field_name |
Defines a unique name for the input element.
Note: This attribute is required with type="button",
type="checkbox", type="file",
type="hidden", type="image",
type="password", type="text", and
type="radio"
|
| readonly |
readonly |
Indicates that the value of this field cannot be modified.
Note: Only used with type="text"
|
| size |
number_of_char |
Defines the size of the input element.
Note: Cannot be used with type="hidden"
|
| src |
URL |
Defines the URL of the image to display.
Note: Only used with type="image"
|
| type |
button
checkbox
file
hidden
image
password
radio
reset
submit
text |
Indicates the type of the input element. The default value is
"text":
Button control
checkbox control
file select control
hidden control
image control
password input control
radio button control
reset button control
submit button control
text button control
|
| value |
value |
For buttons, reset buttons and submit buttons:
Define the text on the button.
For image buttons: Define the symbolic result of the field
passed to a script.
For checkboxes and radio buttons: Define the result of the
input element when clicked.
For hidden, password, and text fields: Define the default
value of the element. |
Standard Attributes
| id, class, title, style, dir, lang, xml:lang |
For a full description, go to Standard
Attributes.
Event Attributes
| tabindex, accesskey, onfocus, onblur, onselect, onchange,
onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove,
onmouseout, onkeypress, onkeydown, onkeyup |
For a full description, go to Event Attributes.
Example
| Source |
Output |
<form action="test.htm" method="GET"
target="_new">
<p><input type="text" name="email" size="10" value="email@">
<input type="submit" value="Subscribe" name="B1"></p>
</form>
|
|
|
|