O'Reilly logo

Essential JavaScript™ for Web Professionals, Second Edition by Dan Barrett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Project III: Random Banner Ad Rotator Script

Word of your skills with JavaScript and images has spread to the marketing department, and they have tracked you down for a project that is near and dear to their hearts. Currently on the site, at the top of every secondary page, there is a little banner advertisement for one of the company's products that, if clicked, will take the user to the store section of the site (see Figure 2-5). The way it is set up now is that if they want to have different products showing up, they need to hardcode which product banner goes on a specific page. Because it's quite a hassle to keep track of multiple images and which page they show up on, up until now they have settled for having just a single product banner ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required