A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/Image below:

Image · WebPlatform Docs

Image Summary

Legacy. Use document.createElement(“img”) instead. Quickly constructs an img element.

Overview

A shorter legacy constructor for creating and loading images.

Properties

No properties.

Methods

No methods.

Events

No events.

Examples

The 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.|

Notes

The loading process of the image starts as soon as its src property is set, even when not added to a document.

Related specifications
WHATWG HTML
Living Standard
HTML5
Last Call Working Draft
Attributions

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