<img>


HTML DOM Image object


Image object

Image objects represent embedded images.

Each time the <img> tag appears, an Image object is created.


Image object attributes

W3C: W3C standard.

AttributeDescriptionW3C
alignSets or returns alignment with inline content.Yes
altSets or returns alternate text when an image cannot be displayed.Yes
borderSets or returns the border around the image.Yes
completeReturns whether the browser has finished loading the image.No
heightSets or returns the height of the image.Yes
hspaceSets or returns blanks to the left and right of the image.Yes
longDescSets or returns the URL to the document that contains the image description.Yes
lowsrcSets or returns the URL to a low-resolution version of the image.No
nameSets or returns the name of the image.Yes
srcSets or returns the URL of the image.Yes
useMapSets or returns the value of the usemap property of the client image map.Yes
vspaceSets or returns blanks at the top and bottom of the image. Yes
widthSets or returns the width of the image. Yes

Image object events

EventDescriptionW3C
onabortEvent handler called when the user abandons the loading of the image.Yes
onerrorEvent handler called when an error occurs while loading the image.Yes
onloadEvent handler called when the image has finished loading.Yes

Standard Properties and Events

Image objects also support standard properties and events .