1. Home
  2. Computing & Technology
  3. JavaScript

Cycling Banner

1. Introduction and Sample

More of this Feature

Obtain the Script Add to Your Page

One method of creating an animated image is to create it as an animated gif file. This is all very well for simple images but what happens if you want to include photos or other complex images in your animation sequence?

The answer is to use a Javascript function to replace the image at regular intervals, that way you can use whatever images that you like in the sequence as long as all of the images are the same size. Since this effect is often used to replace ad banners, it is usually referred to as a rotating banner script but as you will see, the effect can be used for whatever images you like as long as they are all the same size.

Here is an example of the cycling banner script in action.

Cycling banner images

If this is the effect that you want to add to your page then the next step is to obtain the script.

Sample Page | Obtain the Script | Add to Your Page
Explore JavaScript
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.