
Here we use JavaScript to change an image to another image after a specified time, 3 seconds in this case. The JavaScript code is:
and the HTML code:

In the HTML code img3 would be the first image, i.e., document.images[0].src. The JavaScript code does the following:
//=============================
var imageOne=new Image()
imageOne.src="img1.gif"
//=========================
// Constructs a new image called imageOne, and assigns its source as
// img1.gif. This loads the image so that it is ready for imediate use.
//=============================
function changeIt(){
document.images[0].src="img1.gif"
}
//=============================
// Function which when called will change the first image to img1.gif
//============================
setTimeout("changeIt()",3000)
//============================
// Calls the function after 3000 milliseconds. This is not in a function
// So it executes when the JavaScript is loaded.
Still More
© Carl Adler 1997