Creating Cycling BannersWhen you surf the Web, it's common to see advertising banners that periodically switch between images. Some of these are animated GIF files, which are GIF files that contain a number of frames that play in succession; others are Flash animations. If you want to have a page that cycles through a number of GIFs (either animated or not), you can use JavaScript to do the job, as in Script 4.13. This example uses three GIFs and cycles repeatedly through them, as shown in Figures 4.10, 4.11, and 4.12. The simple HTML page is shown in Script 4.12. Script 4.12. The HTML loads the first image in the cycling banner; the JavaScript handles the rest.Script 4.13. You can use JavaScript to cycle between images in a banner.
Figure 4.10. The first image, which starts the cycling banner...Figure 4.11. ...the second image...Figure 4.12. ...the final image. Once the page loads and the banner begins cycling, the animation continues with no user intervention required.To create cycling banners:
Tips
|