HTML Elements
Creates a button control. | HTML 2, 3.2, 4, 4.01, 5 |
HTML Syntax
<input
accesskey = key
class = classname
datafld = fieldname
dataformatas = html | text
datasrc = #id
dir = ltr | rtl
disabled
id = value
name = name
size = n
style = css properties
tabindex = n
title = text
type = submit
value = value
event = script
>
The INPUT type=button element renders a push button on an HTML form. The text to be displayed in the button is specified thru its value attribute.
<input type="button" value="Click me">
Push buttons have no default behavior. Each push button may have client-side scripts associated with the element’s event attributes, to make the button perform an action when an event occurs, such as when the user presses the button, releases it, etc.
Note that authors can create push buttons with the BUTTON element as well, that offers richer rendering capabilities than the INPUT element.
INPUT Members
In most cases, a script is used to make the button perform an action when the user clicks the button. This is done by specifying any ECMAScript-compliant statement or function call as the value of the button's onclick event attribute. When the event occurs, the associated script is triggered.
<form>
<input type="button" value="Say Hello"
onclick="alert ( 'Hello' )">
</form>
BUTTON, INPUT