Html-button-tag

提供:Dev Guides
移動先:案内検索

HTML-ボタンタグ

説明

HTML <button>タグは、HTMLフォーム内でボタンを作成するために使用されます。 <input>タグを使用して、同様のボタンを作成することもできます。

<!DOCTYPE html>
<html>

   <head>
      <title>HTML Button Tag</title>
   </head>

   <body>
      <form>
         <button name = "button" value = "OK" type = "button">Click Me</button>
      </form>
   </body>

</html>

これは、次の結果を生成します-

グローバル属性

このタグは、リンク:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします

特定の属性

HTML <button>タグは、次の追加属性もサポートしています-

Attribute Value Description
autofocus html-5 autofocus Specifies that the button should have input focus when the page loads.
disabledhtml-5 disabled Specifies the button is disabled.
form html-5 form_id Specifies the forms to which button belongs.
formaction html-5 URL Specifies the link where the form submits.
formenctype html-5 applicationmultipart/form-datatext/plain Specifies how the form data is encoded before sending it to server.
formmethod html-5 get post Specifies how to send form data.
formnovalidatehtml-5 formnovalidate Specifies that the form data should not be validated.
formtarget html-5 _blank _self _parent _top Specifies where the response should be validated.
name name Specifies the button name.
type button reset submit Specifies the button type.
value text Specifies button’s initial value.

イベント属性

このタグは、link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートしています。

ブラウザのサポート

Chrome Firefox IE Opera Safari
Yes Yes Yes Yes Yes