Html-form-tag
提供:Dev Guides
HTML-<form>タグ
説明
HTML <form>タグは、ユーザー入力用のフォームを作成するために使用されます。 フォームには、テキストフィールド、チェックボックス、ラジオボタンなどを含めることができます。 フォームは、指定されたURLにユーザーデータを渡すために使用されます。
例
<!DOCTYPE html>
<html>
<head>
<title>HTML form Tag</title>
</head>
<body>
<form action = "/cgi-bin/hello_get.cgi" method = "get">
First name:
<input type = "text" name = "first_name" value = "" maxlength = "100"/>
<br/>
Last name:
<input type = "text" name = "last_name" value = "" maxlength = "100"/>
<input type = "submit" value ="Submit"/>
</form>
</body>
</html>
これは、次の結果を生成します-
グローバル属性
このタグは、リンク:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします
特定の属性
HTML <form>タグは、次の追加属性もサポートしています-
Attribute | Value | Description |
---|---|---|
accept | MIME_type | Specifies a comma-separated list of content types that the server accepts. |
accept-charset | charset list | Specifies a list of character encodings that the server accepts. The default value is "unknown". |
action | URL | Specifies a URI/URL of the back-end script that will process the form |
autocompletehtml-5 | onoff | Specifies whether form should have autocomplete on or off |
enctype | mimetypes | The mime type used to encode the content of the form. |
method | getpost |
Specifies the HTTP method to use when the form is submitted. Possible values −
|
name | form name | Defines a unique name for the form. |
novalidate html-5 | novalidate | Specifies that the form should not be validated when submitted. |
target | _blank _self _parent _top |
Target to open the given URL. _blank-ターゲットURLは新しいウィンドウで開きます。 _self-ターゲットURLは、クリックされたときと同じフレームで開きます。 _parent-ターゲットURLは親フレームセットで開きます。 _top-ターゲットURLはウィンドウ全体で開きます。 |
イベント属性
このタグは、link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートしています。
ブラウザのサポート
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |