General
Use this Image Loader script to delay the loading of a particular image. It can be used to delay the loading of large images or banner advertisements. A smaller image is loaded first, which can be transparent or blank. After a designated amount of time the larger image will load in place of the smaller one.
Notes
- Created by: Sandeep Gangadharan
- Web Site: http://www.sivamdesign.com/scripts/
- Posted: February 2, 2007
Source Code
Paste this source code into the designated areas.
External file
Paste this code into an external JavaScript file named: delayedImageLoader.js
/* This script and many more are available free online at
The JavaScript Source!! http://javascriptsource.com
Created by: Sandeep Gangadharan | http://www.sivamdesign.com/scripts/ */
function runBanner() {
// change the name of the image below
document.getElementById('banner').src='large_img.gif';
}
// change the number below to adjust the time the image takes to load
window.setTimeout("runBanner()", 5000);
Head
Paste this code into the HEAD
section of your HTML document.
<script type="text/javascript" src="delayedImageLoader.js"></script>
Body
Paste this code into the BODY
section of your HTML document
<img src="small_img.gif" border="0" id="banner">