--- title: slug: Web/HTML/Element/Input/image translation_of: Web/HTML/Element/input/image ---
{{HTMLRef}}

<input type="image"> 标签是一个图片提交按钮。 你必须使用 src 属性来定义图片的源,并且使用alt来定义当图片无法显示的时候的替代文字。 height 和width属性是用来定义图片的高和宽的。

Permitted content None, it is an {{Glossary("empty element")}}.
Tag omission Must have a start tag and must not have an end tag.
Permitted parent elements Any element that accepts phrasing content.
DOM interface {{domxref("HTMLInputElement")}}

Attributes

This element includes the global attributes.

{{htmlattrdef("type")}}

{{htmlattrdef("formaction")}} {{HTMLVersionInline("5")}}
The URI of a program that processes the information submitted by the input element, here image if specified, it overrides the {{htmlattrxref("action","form")}} attribute of the element's form owner.
{{htmlattrdef("formenctype")}} {{HTMLVersionInline("5")}}
If the input element is an image, this attribute specifies the type of content that is used to submit the form to the server. Possible values are:

If this attribute is specified, it overrides the {{htmlattrxref("enctype","form")}} attribute of the element's form owner.

{{htmlattrdef("formmethod")}} {{HTMLVersionInline("5")}}
In image input element, this attribute specifies the HTTP method that the browser uses to submit the form. Possible values are:

If specified, this attribute overrides the {{htmlattrxref("method","form")}} attribute of the element's form owner.

{{htmlattrdef("formnovalidate")}} {{HTMLVersionInline("5")}}
This Boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the {{htmlattrxref("novalidate","form")}} attribute of the element's form owner.
{{htmlattrdef("formtarget")}} {{HTMLVersionInline("5")}}
This attribute is a name or keyword indicating where to display the response that is received after submitting the form. This is a name of, or keyword for, a browsing context (for example, tab, window, or inline frame). If this attribute is specified, it overrides the {{htmlattrxref("target", "form")}} attribute of the element's form owner. The following keywords have special meanings:
{{htmlattrdef("height")}} {{HTMLVersionInline("5")}}
This attribute defines the height of the image displayed for the button.
{{htmlattrdef("required")}} {{HTMLVersionInline("5")}}
This attribute specifies that the user must fill in a value before submitting a form but it cannot be used when the type attribute is image type (submit, reset, or button). The {{cssxref(":optional")}} and {{cssxref(":required")}} CSS pseudo-classes will be applied to the field as appropriate.
{{htmlattrdef("src")}}
This attribute specifies a URI for the location of an image to display on the graphical submit button; otherwise it is ignored.
{{htmlattrdef("usemap")}} {{HTMLVersionInline(4)}} only, {{obsoleteGeneric("inline", "HTML5")}}
The name of a {{HTMLElement("map")}} element as an image map.
{{htmlattrdef("width")}} {{HTMLVersionInline("5")}}
This attribute defines the width of the image displayed for the button.

Examples

Firefox logo input image example

<input type="image" name="image" src="/files/2917/fxlogo.png" width="50">

Result

{{ EmbedLiveSample('simple_input_image_example') }}

Specifications

Specification Status
{{SpecName('HTML WHATWG', 'https://html.spec.whatwg.org/multipage/forms.html#image-button-state-%28type=image%29', '<input type="image">')}} {{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', 'http://www.w3.org/TR/html5/forms.html#image-button-state-%28type=image%29', '<input type="image">')}} {{Spec2('HTML5 W3C')}}
{{SpecName('HTML4.01', 'interact/forms.html#h-17.4', '<form>')}} {{Spec2('HTML4.01')}}

Browser compatibility

{{Compat("html.elements.input.input-image")}}