Image()

jayden·2020년 5월 2일
0

javascript

목록 보기
4/5

Image()

The Image() constructor creates a new HTMLImageElement instance. It is functionally equivalent to document.createElement('img').

Disambiguation: image(), the CSS function notation.

Syntax

var htmlImageElement = new Image(width, height);

Parameters
width
The width of the image (i.e., the value for the width attribute).
height
The height of the image (i.e., the value for the height attribute).

var myImage = new Image(100, 200);
myImage.src = 'picture.jpg';
document.body.appendChild(myImage);

출처: https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/Image

profile
DevOps 너로 정했다!

0개의 댓글