Image Object Demonstration
| Individually Loaded | Pre-cached |
| Image: |
 |
 |
| Select image: |
Understanding This Demonstration
The purpose of this page is twofold:
- To show the perceived performance enhancements of pre-cached images
- To show how to script continually rotating images (e.g., advertising images)
When this page loads, it automatically pre-caches four images that are immediately available in the right-hand pane. Select an image from the pop-up list below the right-hand pane to see how the images instantly snap into view.
In the left-hand pane, only the first image is loaded with the page. Each of the others (selectable from the pop-up list below the left-hand pane) must be loaded when called. After each one of these images loads, it is cached for instant access until you quit Navigator.
The idea here is that as long as the visitor is waiting for a page to load, all the images may as well be downloaded up front, allowing for instantaneous image access thereafter.
Activating the checkbox turns on a function that continually cycles through all pre-cached images at five-second intervals.
Scripting techniques of note:
- Assigning names to images files that are algorithmically convenient for array and loop counting.
- Controlling the selected option in a select object on the fly
Danny's FAQ | JavaScript Table of Contents