HTML <form>ターゲット属性

❮HTML<form>タグ

受信した応答を新しいウィンドウまたはタブに表示します。

<form action="/action_page.php" method="get" target="_blank">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <input type="submit" value="Submit">
</form>

定義と使用法

このtarget属性は、フォームの送信後に受信した応答を表示する場所を示す名前またはキーワードを指定します。

このtarget属性は、ブラウジングコンテキスト(タブ、ウィンドウ、インラインフレームなど)の名前またはキーワードを定義します。


ブラウザのサポート

Attribute
target Yes Yes Yes Yes Yes

構文

<form target="_blank|_self|_parent|_top|framename">

属性値

Value Description
_blank The response is displayed in a new window or tab
_self The response is displayed in the same frame (this is default)
_parent The response is displayed in the parent frame
_top The response is displayed in the full body of the window
framename The response is displayed in a named iframe

❮HTML<form>タグ