MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

Image

Image Element constructor

Accepts two optional parameters: Image([unsigned long width, unsigned long height])

Example:

var myImage = new Image(100, 200);
myImage.src = 'picture.jpg';
console.log(myImage);
Result:
<img width="100" height="200" src="picture.jpg">

 

Note: this constructor exists for historical reasons only and returns an HTMLImageElement instance just as document.createElement('img') would.

 

Document Tags and Contributors

 Last updated by: teoli,