start page | rating of books | rating of authors | reviews | copyrights

JavaScript: The Definitive Guide

Previous Chapter 16
Special Effects with Images
Next
 

16.4 Other Image Properties

The Image object has a few other properties as well. Most of them are read-only properties that simply mirror attributes of the <IMG> tag that created the image. The width, height, border, hspace, and vspace properties are read-only integers that specify the size of the image, the width of its border, and the size of its horizontal and vertical margins. These properties are set by the attributes of the IMG tag which share their names.

Finally, the lowsrc property of the Image object mirrors the LOWSRC attribute of the IMG tag. It specifies the URL of an optional image to display when the page is viewed on a low-resolution device. The lowsrc property is a read/write string, like src is, but unlike the src property, setting lowsrc does not cause the browser to load and display the newly-specified low-res image. If you want to perform an animation, or some other special effect, that works with low-resolution images as well as high-resolution, then always remember to update the lowsrc property before you set the src property. If the browser is running on a low-resolution device when you set the src literal, it will load the new lowsrc image instead.


Previous Home Next
Image Event Handlers Book Index Image Replacement Example

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell