Contents:
Image Replacement with the Image.src Property
Off-Screen Images and Caching
Image Event Handlers
Other Image Properties
Image Replacement Example
Other Image Techniques
In Navigator 3.0, the images[] property of the Document object is an array of Image elements, each one representing one of the inline images, created with an <IMG> tag, that is contained in the document. While web browsers have always been able to display images with the <IMG> tag, the addition of the Image object in Navigator 3.0 is a major step forward--it allows programs to dynamically manipulate those images.
The main feature of the Image object is that its src property is read/write. You can read this property to obtain the URL from which an image was loaded. And more importantly, you can set the src property to make the browser load and display a new image in the same space. In order for this to work, the new image must have the same width and height as the original one.
The ability to dynamically replace one image in a static HTML document with another image opens the door to any number of special effects, from animation, to images that change when clicked on, to "digital clocks" that update themselves in real time. With a bit of thought, you can probably imagine many more potential uses for this technique. In order to make the image replacement technique viable, and in order to make animations and other special effects responsive enough to be useful, we need some way to ensure that the necessary images are loaded into the browser's cache.
file: /Techref/language/java/script/definitive/ch16_01.htm, 5KB, , updated: 2019/10/14 15:00, local time: 2024/11/15 11:27,
3.147.81.128:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://massmind.ecomorder.com/Techref/language/java/script/definitive/ch16_01.htm"> [Chapter 16] Special Effects with Images</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Welcome to massmind.ecomorder.com! |
.