HTML » Tags » button

Version: 4.0

Compability: Explorer 4, 5  Netscape 6

<button> ... </button>

The <button> tag is used to create a button form control (field). Control is a technical term that refers to the various elements (buttons, check boxes, radio buttons, text areas) that can be used inside a form to gather information.

The four tags that can be used to build a form are:
button     input     select     textarea
Specifically, the button tag is used to create a button in a form that can have content, consist of an image, and have the illusion of 3-dimensions. The buttons created using the input tag, including the type="image", cannot have content or display with a 3-D appearance. (Otherwise, there is little difference.)
Any text or images placed between the opening and closing button tags will be displayed on the button. The text can include most HTML tags and they will perform as expected. The one major exception is that you cannot display an image map using the map and area tags.
A button element should not contain other button tags, nor should it contain fieldset, form, iframe, input, isindex, label, select, or textarea tags.
The closing tag is mandatory.


<form action="html_button.html" method="get">
<button type="button" onclick="JavaScript: alert('Text Button')">
Please Click This Button!


When you click on the button with the mouse, an alert is displayed.

Language(s): HTML

See Also: