Legacy. Use document.createElement(“img”) instead. Quickly constructs an img element.
OverviewA shorter legacy constructor for creating and loading images.
PropertiesNo properties.
MethodsNo methods.
EventsNo events.
ExamplesThe following script creates a new image and appends it to the body element.
var img = new Image(50, 50);
img.src = "image.png";
document.body.appendChild(img);
Usage
Use this constructor as a shorter way to instantiate new img elements before adding them to the document.
Syntax -
new Image(width, height)
You can specify up to two optional arguments:
||
|width|Optional. Integer that specifies the img width.|
|height|Optional. Integer that specifies the img height.|
The loading process of the image starts as soon as its src property is set, even when not added to a document.
Related specificationsMicrosoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4