input

Form

<input type="text">
<input type="password">
<input type="hidden">
<input type="checkbox">
<input type="radio">
<input type="button">
<input type="file">
<input type="image">
<input type="reset">
<input type="submit">
<input type=" ... " /> (description in XHTML)

Attributes

attribute default description
id none specifies the id name
class none specifies the style sheet class
style none specifies the style sheet
type none specifies the type of the input element
name none specifies the name
value none specifies the intial value for the input field
size none specifies the width of the input element (in half-size characters)
maxlength none specifies the maximum number of characters (in half-size characters) allowed in a text field
checked --- specifies that "radio" or "checkbox" are checked by default
alt none specifies the alternative text of the image
align none specifies the alignment
src none specifies the URL of the image
readonly --- specifies that the input element should be readonly
disabled --- specifies that the input element should be disabled

Support

HTML 2, HTML 3.2, HTML 4.01 [STF], XHTML 1.0 [STF], XHTML 1.1, XHTML Basic
Microsoft (MSDN)
[IE3 or later][Firefox 1 or later][Safari 1 or later][Opera 3 or later][Netscape 2 or later]

Explanation

The input tag specifies an input form element. You can specify attributes as follows. Specify the text displayed in button and text field using the value attribute. In XHTML, describe like <input type=" ... " />.
specific value description
text one-line text input field
password password. An entry is hidden by marks such as asterisks and bullets.
hidden hidden data. Though the data is not displayed, it is submitted.
checkbox checkbox. Use in the case of choosing several items from among choices.
radio radio button. Use in the case of choosing only one item from among choices.
button button.
file selection of local file. When clicking on it, a file selection dialogue is shown.
image image button. Though it works like the submit button, the coordinates of the button on which clicked will be submitted.
reset reset button. Clicking on it, the form content will turn back to the initial state.
submit submit button.

Related Tags

fieldset, form, legend, textarea

Sample Code [Output]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=shift_jis">
<title>Sample</title>
</head>
<body>
<h1>Sample</h1>
<form method="get" action="../bbs.cgi">
<input type="text"><br>
<input type="password"><br>
<input type="hidden"><br>
<input type="checkbox">CheckBox<br>
<input type="radio" name="rGrp">RadioButton 1<br>
<input type="radio" name="rGrp">RadioButton 2<br>
<input type="button" value="Button"><br>
<input type="file"><br>
<input type="image" src="btn.jpg" alt="Submit"><br>
<input type="reset"><br>
<input type="submit"><br>
</form>
</body>
</html>