please dont rip this site

JavaScript: The Definitive Guide

Previous Chapter 16 Next
 

16. Special Effects with Images

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.

16.1 Image Replacement with the Image.src Property

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.


Previous Home Next
Cookie Example Book Index Off-Screen Images and Caching

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

file: /Techref/language/java/SCRIPT/definitive/ch16_01.htm, 5KB, , updated: 2019/10/14 15:00, local time: 2024/11/23 04:37,
TOP NEW HELP FIND: 
3.138.175.166: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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://techref.massmind.org/Techref/language/java/SCRIPT/definitive/ch16_01.htm"> [Chapter 16] Special Effects with Images</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .