Latest web development tutorials

HTML DOM Image Object

Image Object

Image object represents an embedded image.

<Img> tag occurs every time an Image object is created.


Image Object Properties

W3C: W3C standards.

属性 描述 W3C
align 设置或返回与内联内容的对齐方式。 Yes
alt 设置或返回无法显示图像时的替代文本。 Yes
border 设置或返回图像周围的边框。 Yes
complete 返回浏览器是否已完成对图像的加载。 No
height 设置或返回图像的高度。 Yes
hspace 设置或返回图像左侧和右侧的空白。 Yes
longDesc 设置或返回指向包含图像描述的文档的 URL。 Yes
lowsrc 设置或返回指向图像的低分辨率版本的 URL。 No
name 设置或返回图像的名称。 Yes
src 设置或返回图像的 URL。 Yes
useMap 设置或返回客户端图像映射的 usemap 属性的值。 Yes
vspace 设置或返回图像的顶部和底部的空白。 Yes
width 设置或返回图像的宽度。 Yes

Image Object Events

event description W3C
onabort Event called when the user give up the image loading handle. Yes
onerror Event handler called when an error occurs during the loading of an image. Yes
onload Event called when the image is finished loading handle. Yes

Standard properties and events

Image object also supports the standard attributes and events .