HTML DOM Input Image Object

Input Image object

The Input Image object is a new object in HTML5.

The Input Image object represents the HTML <image> element.

Access the Input Image object

You can access the <image> element by using getElementById():

var x = document.getElementById("myImage");

Tip:You can also traverse the form's elements collection to access the Input Image object.

Creating Input Image Object

You can create an <image> element by using the document.createElement() method:

var x = document.createElement("INPUT");
x.setAttribute("type", "image");

Input Image Object Properties

Properties Description
autocomplete Set or return the autocomplete attribute value of the email field.
alt Set or return the alt attribute value of the input image.
autofocus Set or return whether the input image should automatically focus after the page is loaded.
defaultValue Set or return the default value of the input image.
disabled Set or return whether the input image is disabled.
form Return a reference to the form that contains the input image.
formAction Set or return the formaction attribute of the input image.
formEnctype Set or return the formenctype attribute of the input image.
formMethod Set or return the formmethod attribute of the input image.
formNoValidate Set or return whether form data (form-data) should be validated when submitting the form.
formTarget Set or return the formtarget attribute of the input image.
height Set or return the height attribute of the input image.
name Set or return the name attribute of the input image.
src Set or return the src attribute of the input image.
type Return the form element type of the input image field.
value Set or return the value attribute of the input image.
width Sets or returns the width attribute value of the input image.

Standard Attributes and Events

Input Image Object Supports StandardsPropertiesAndEvents.

Related Pages

HTML Tutorial:HTML Forms

HTML Reference Manual:HTML <input> Tag

HTML Reference Manual:HTML <input> type attribute