Persistent Random Banners
Persistent Random Banners
I am writing this column from the French Alps, enjoying my yearly ski vacation. In this short column we present a new type of banner, first introduced in Jamie Jaworski's SuperScripter. We have previously presented various types of banners in our columns. The first one was a rotating text banner. In this banner, an array of messages is rotating on a fixed schedule, showing one message at a time. The second one we described was a sliding JavaScript banner. In this one, the effect of sliding is achieved by gradually revealing a new message while hiding the previous one. As in the previous banner, the sliding speed is predetermined and so is the number of the messages and the order in which they appear. The third banner we programmed was a scrolling HTML board, brought to you in three versions: Netscape Navigator, Internet Explorer, and browser-independent. This banner shows multiple messages that scroll up, showing off new messages at the bottom and removing old ones at the top. The speed of scrolling is predetermined and so is the order of the messages across the board.
Doc JavaScript Tip of the Day |
The banner we show in this column is different. The message displayed in this banner is determined upon loading and does not change until a further reloading of the page. The message on this page is randomly selected from a feed of preprepared messages. The selection does not need to be random, however. The banner can be programmed to display a new message every hour of the day, every day of the week, every day of the month, or just a random message every time the page loads or reloads. Obviously, if you have a long message feed and you decide to go with these persistent random messages (a new message every day of the week, for example), some messages will never show up.
In this column you will learn:
- How to embed the persistent random banner in a page
- How to select a message
- How to build the message feed
We also include the listings of our code and our message feed.
Next: How to embed the persistent random banner in a page
Produced by Yehuda Shiran and Tomer Shiran
Created: May 8, 2000
Revised: May 8, 2000
URL: https://www.webreference.com/js/column61/index.html