Image() (Constructor)

A constructor for new browser images.

Availability:

JavaScript - 1.1
JScript - 3.0
Internet Explorer - 4.0
Netscape - 3.0
JavaScript syntax:-new Image()

When the Image constructor is used in a new expression it creates a new object based on the Image prototype.

You can then assign values to the properties of that new Image object as needed.

Image objects are generally constructed so that image assets can be requested from the server and retained in the browser cache. This can happen in the background without the image needing to appear on the display.

Then, when you need to perform an image replacement, the browser knows that the image is stored locally and can be located more quickly than if it had to request it from the server at the time it is required.

This can significantly speed up the animation effects you choose to reproduce.

See also:Web browser