AUTHOR:Heidi
Allen TYPE: Freeware BROWSERS: Javascript enabled all
With this script you can rotate clickable images in real-time, without
requiring banner rotation software or page reloads/refreshes. This script will
also rotate non-clickable images (images without links) and work within tables.
EXAMPLE
You should see a new banner rotating every 7 seconds:
1) Insert this script in the <HEAD> section of the page.
2) Insert the following script also in the <HEAD> section.
NOTE: if you want to cycle images without links attached to them, use the first
script above only.
3) Insert the onLoad event handler inside the <BODY> tag as
follows:
<body onLoad="window.setTimeout('cycle();',7000);(loadbanners());(urlswitch());",
followed by other tags such as bgcolor, etc..
4) Insert the following HTML code in the <BODY> section where
you want the rotating banners to appear in the page.
5) Define the number of banners, the images and their path in this section of the
first script:
function cycle() {
if (++banners > 3) banners=1; // define the number of banners
here (3 in this example)
loadbanners();
document.banner1.src = image;
window.setTimeout('cycle();',7000);
}
function loadbanners() {
if (banners==1)
{
image="images/banner1.gif";
}
if (banners==2)
{
image="images/banner2.gif";
}
if (banners==3)
{
image="images/banner3.gif";
6) Define the URL links for each banner in this section of the second
script:
var link = "http://planmagic.com/financial_planning.html"
function urlswitch() {
if (banners==1)
{
link = "http://planmagic.com/business_planning.html";
}
if (banners==2)
{
link = "http://planmagic.com/marketing_planning.html";
}
if (banners==3)
{
link = "http://planmagic.com/financial_planning.html";
7) Choose how fast you want your images to cycle in this section of
the script:
window.setTimeout('cycle();',7000); // the
default is a new image every 7 seconds