If you change the src property of an image it will be replaced on the browser's display screen. The only limitation is that the images that are replaced are exactly the same shape and size as the previous image.
Some browsers may forgive you if you display differently sized images, and some may scale the images to fit.
This can lead to all manner of creative effects such as rollover highlights, clocks, animations, progress bars etc. You can also simulate checkboxes graphically as well as all manner of other useful and 'pretty' user interface widgets.
For animations to work smoothly, you should ensure that the images have been cached locally first otherwise the animation will appear somewhat jerky while they are fetched from a server.
See also: | Image animation, Image preloading, IMG.src |
Prev | Home | Next |
Image.name | Up | Image.vspace |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |