devxlogo

Animating Images with JavaScript

Animating Images with JavaScript

Animating between a number of images is fairly easy to do and works in Netscape Navigator 3.0+ and Internet Explorer 4.0+. Put the URLs of the images you’d like to show into an array and create a variable to store your current place in that array. Once the user clicks on the link to start the animation use the setTimeout command to call your routine at regular intervals and display the next image. The following code shows you how to use the setTimeout command to switch among a number of images in an array.

 Animate Image

devx-admin

Share the Post: