JavaScripture
Contribute via GitHub Feedback

HTMLImageElement : HTMLElement

HTMLImageElement is an element that displays an image. It corresponds to the <img> tag. See also Image.

Instance Properties

alt : String

Alternate text describing the image.

Example:

Run

Results:

 

complete : Boolean

Returns true once the image has loaded.

Example:

Run

Results:

 

height : Number

The display height (in pixels) of the image. If not set, the height will be naturalHeight after the image loads.

Example:

Run

Results:

 

naturalHeight : Number  

The pixel height of the image buffer. May be different than the height displayed on screen if height is set on the image.

Example:

Run

Results:

 

naturalWidth : Number  

The pixel width of the image buffer. May be different than the width displayed on screen if width is set on the image.

Example:

Run

Results:

 

src : String

The location of the image.

Example:

Run

Results:

 

width : Number

The display width (in pixels) of the image. If not set, the width will be naturalWidth after the image loads.

Example:

Run

Results:

 

Instance Events

onload / 'load'  
listener(event : Event) : undefined

Fired when the image has loaded. After this point this.complete will be true.

Example:

Run

Results: