Obiekt Image DOM HTML
Obraz
The Image object represents the HTML <img> element.
Access the Image object
You can access the <img> element using getElementById():
var x = document.getElementById("myImg");
Tip:You can also use images collection Access the <img> element.
Creating an Image object
You can create an <img> element using the document.createElement() method:
var x = document.createElement("IMG");
Image object properties
Properties | Description |
---|---|
align |
Not supported in HTML5.Please use style.cssFloat. Set or return the value of the align attribute of the image. |
alt | Set or return the value of the alt attribute of the image. |
border |
Not supported in HTML5.Please use style.border. Set or return the value of the border property of the image. |
complete | Return whether the browser has finished loading the image. |
crossOrigin | Set or return the CORS settings of the image. |
height | Set or return the value of the height property of the image. |
hspace |
Not supported in HTML5.Please use style.margin. Set or return the value of the hspace property of the image. |
isMap | Set or return whether the image should be part of the server-side image map. |
longDesc |
Not supported in HTML5. Set or return the value of the longdesc attribute of the image. |
lowsrc |
Not supported in HTML5. Set or return the URL of the low-resolution version of the image. |
name |
Not supported in HTML5.Please use id. Set or return the value of the name property of the image. |
naturalHeight | Return the original height of the image. |
naturalWidth | Return the original width of the image. |
src | Set or return the value of the src property of the image. |
useMap | Set or return the value of the usemap property of the image. |
vspace |
Not supported in HTML5.Please use style.margin. Set or return the value of the vspace property of the image. |
width | Set or return the value of the width property of the image. |
Standard properties and events
The Image object supports both standardsPropertiesandEvents.