banner ad rotation script

JavaScripts javascripts
 

JavaScript
categories

Animation
Background
Bookmarks
Buttons
Calculators
Cookies
Data handling
E-mail
Enhancements
Forms
Image rotation
Menus
Messages
Miscellaneous
Music
Password protection
Redirection
Scrollers
Tables
Time & date
Windows

Publishers

Add script
Account login

 

Home > Scripts > DHTML scripts & JavaScripts > Image rotation > Banner ad rotation script

 

Banner ad rotation script

AUTHOR: Anarchos
TYPE: Freeware
BROWSERS: Javascript enabled all

This object oriented banner ad rotator script allows you to rotate multiple banner ads on your page and change them after a certain time. The script can also display a status bar message on MouseOver. The rotating banners have to be of the same size. Our example rotates 3 different banners and the images are set to refresh every five seconds.


EXAMPLE


1) Download this ZIP file with the bannerad3.js script file and unzip into the appropriate directory.

2) Insert this script in the <HEAD> section of the page.

then copy (CTRL-C) & paste (CTRL-V)

 

3) Insert this script in the <BODY> section where you want the rotating banners to appear in the page.

then copy (CTRL-C) & paste (CTRL-V)

4) Define the timer, the size of the banners, the images and their location, the URL links associated to each banner and the messages to be displayed in this section of the script:

// time between rotations (seconds), width and height of banners, alt text, starting banner, and random (0 means it iterates through banners, 1 means it randomly picks the next banner)
myAd = new Banner( 5, 468, 60, "Visit our sponsor", 1, 0 );

// path to image, url, target window, and mouseover message
myAd.Ad( "banners/banner_1.gif", "business_planning.html", "_blank", "Business planning" );
myAd.Ad( "banners/banner_2.gif", "marketing_planning.html", "_blank", "Marketing planning" );
myAd.Ad( "banners/banner_3.gif", "financial_planning.html", null, "Financial planning" );

You can add as many banners as you like. If you want to have multiple banner ad rotators on the same page, don't use myAd as the variable name for each one. You'll need a different name for each rotator.

5) Define where the bannerad3.js file is located in script call you've placed in the <HEAD> section:

<script src="banners/bannerad3.js" type="text/javascript"></script>


[BACK] [TOP]

 

BLOGS - BOOKMARKS - FONTS - FRIENDS - GAMES - HEADLINES
MUSIC - PIXELS - SCRIPTS - SOFTWARE - SOUNDS - WEB SEARCH

 


Copyright © 1997-2008 SimplytheBest.net. Legal Disclaimer.
All copyrights acknowledged. All rights reserved.