Export (0) Print
Expand All
4 out of 8 rated this helpful - Rate this topic

Image object

Creates and initializes a new img element.


The Image object has these types of members:


The Image object has these methods.


Creates a new img element of the specified width and height. This method cannot be called directly. See Image object.


Standards information

There are no standards that apply here.


Use this object to instantiate new img elements before adding them to the document. You can specify up to two optional arguments:

nWidthOptional. Integer that specifies the img width.
nHeightOptional. Integer that specifies the img height.


String values are coerced into their numeric equivalents, if possible.


The following script creates a new image and appends it to the body object..

<script type="text/javascript">
var img = new Image(50, 50);
img.src = "image.png";
document.body.appendChild( img );

See also




Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.