input type="button" ElementThe input type="button" element is an inline element declared by the XHTML 1.1 Forms Module but is not present in the
*W3C XHTML 1.1 Basic Forms Module
Elements in the Forms Module are:form | label | textarea | select | optgroup | option | button | fieldset | legend | input type="button" | input type="checkbox" | input type="file" | input type="hidden" | input type="image" | input type="password" | input type="radio" | input type="reset" | input type="submit" | input type="text"
The input type="button" element is used
within a form to create
a push-button, with the button's text being the contents of
its value attribute. Unlike other button-creating
input elements (input type="submit",
input type="reset" and input type="image"),
this push-button has no allocated function. This means that pushing the button
will have absolutely no effect unless some script (usually JavaScript) is written
to provide functionality. Bear in mind, however, that user agents without scripting
capability (or with scripting disabled) will present the user with a button which does
absolutely nothing. This may be confusing if no explanation is provided. It is
therefore probably best to create such buttons using the same scripting language as
that which assigns the handler.
An example input type="button" element is shown
here, with a simple JavaScript function assigned to its
onclick
attribute:
This renders as:
If your browser supports JavaScript and it is enabled, the above button should function correctly
and thank you for pushing it! If you can view the
HTTP
Response Headers for this page (using, for example, the excellent
*Web Developer Toolbar
for *Firefox),
you will find that I have added a Content-Script-Type header of "text/javascript"
to this page so that the user agent is informed that the
onclick attribute above
contains JavaScript. In normal circumstances, however, all event handling
code is best put in external scripts (and included using the
script element)
rather than by adding attributes from the
Intrinsic Events Module to individual elements.
Note: No name=value pair is sent to the processing URI for an
input type="button" element.
See also the button element.
In Internet Explorer, for reasons unknown, buttons with long text content are usually rendered
with excessive horizontal padding - the longer the button text, the more excessive the padding.
This annoyance can be avoided by using the CSS declarations
width:auto; overflow:visible; and setting the padding
property to the desired value.
Although the type attribute is not #REQUIRED
on the input element, its default value is "text" and so must be present on input type="button".
input type="button" element are listed below:accesskey [ type Character ]disabled [ type Boolean ]name [ type CDATA ]name attribute is usually only used to refer to the button from within scripts.tabindex [ type Number ]value [ type CDATA ]onblur [ type Script ]onfocus [ type Script ]input type="button" element are listed below:class [ type NMTOKENS ]id [ type ID ]style [ type CDATA ], from the Style Attribute Module (deprecated)title [ type Text ]xmlns [ type URI - #FIXED 'http://www.w3.org/1999/xhtml' ]dir [ type Enumeration (ltr | rtl) ], from the Bi-directional Text Modulexml:lang [ type LanguageCode ]All attributes in the
Events Attribute Collection
are supported:onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
input type="button" element is:
EMPTY
See Content Model & Nesting for information about Content Model syntax and Nesting Groups.
input type="button"This element is empty and may have no children.
input type="button"abbr, acronym, address, cite, code, dfn, div, em, h1 - h6, kbd, p, q, samp, span, strong, varadd, dt, licaption, td, thfieldset, label, legendb, big, i, small, sub, sup, ttdel, insbdoobjectrb, rt