<input>
対応ブラウザ | Internet Explorer 2~ Firefox 1~ Google Chrome 1~ Safari 1~ Opera 6~ | ||
---|---|---|---|
タグの分類 | インライン要素、空要素 | 定義バージョン | Strict, Transitional, Frameset |
開始タグ | 必須 | 終了タグ | なし |
用例 |
|
属性
type | 概要 | 部品の形式を指定します。 |
---|---|---|
属性の値 | text、 password 、 radio、 checkbox、 file、 hidden、 submit、 image、 reset、 button | |
name | 概要 | 部品の名前を指定します。 |
属性の値 | 文字列 | |
value | 概要 | 部品の初期値を指定します。 |
属性の値 | 文字列 | |
size | 概要 | 部品の幅(入力フィールドの大きさ)を指定します。 |
属性の値 | 数値 | |
maxlength | 概要 | 入力できる最大文字数を指定します。 |
属性の値 | 数値 | |
checked | 概要 | チェックボックスを選択されている状態にします。 |
属性の値 | (checked) | |
disabled | 概要 | 部品を無効化します。 |
属性の値 | (disabled) | |
readonly | 概要 | 書き換えを禁止し、読み出し専用にします。 |
属性の値 | (readonly) | |
accept | 概要 | プログラム側が受け入れるMIMEタイプを指定します。 |
属性の値 | MIMEタイプ | |
src | 概要 | 表示する画像のURLを指定します。 |
属性の値 | URI | |
alt | 概要 | 画像の代わりに表示する代替テキストを指定します。 |
属性の値 | テキスト | |
usemap | 概要 | イメージマップの関連付けをします。 |
属性の値 | マップ名 | |
ismap | 概要 | サーバーサイド・イメージマップを表示します。 |
属性の値 | (ismap) | |
align | 概要 | 表示位置を指定します。 |
属性の値 | top、middle、bottom、left、right |
<input>とは
「INPUT」とは、<form>タグで作成したフォームの中でテキスト入力欄やボタンなどの部品を作成する要素です。
部品はtype属性の値に指定することが可能で、一行テキストボックス、チェックボックス、ラジオボタン、実行ボタン、リセットボタンなどの部品を作成することができます。
input要素に入力された情報は、データとしてサーバに送信されます。
サンプルデモ
type="text":1行テキストボックスを作る。

type="password":入力した内容にマスクがかかるテキストボックスを作る。

type="radio":ラジオボタンを作る。
radio1 radio2

type="checkbox":チェックボックスを作る。
checkbox1 checkbox2

type="file":ファイル参照ボタンを作る。

type="hidden":非表示のテキストボックスを作る。
type="submit":フォームの実行ボタンを作る。

type="image":画像を使ったフォームの実行ボタンを作る。

type="reset":フォームに入力した内容をリセットするボタンを作る。

type="button":汎用的なボタンを作る。

size="20":テキストボックスのサイズを変更する。
