|
Web Design Tips
FrontPage Universe Tips
Rotating Banners
Here is a great little script for rotating banners throughout your
website. The code in the text box below can be copied and pasted
into a simple text editor and saved, as is, as banner.js. Within
this code you will notice that it is set up with three banners, each
linked to a different url. You can have as many ads in this simple
rotator as you wish, just add them following the same format as the
ones shown. Also, ensure you change the var ad_count number from 3
to however many ads you have in the rotation.
<script Language="JavaScript">
var ad_count = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % ad_count;
ad +=1;
if (ad==1) {
url="http://www.frontpagewebwizard.com/webtools/guestbook/index.php";
alt="The World's Best Guestbooks - Frontpagewebwizard.com";
banner="http://images.frontpagewebwizard.com/frontpagewebwizard/
images/affiliate/br5.gif";
width="468";
height="60";
}
if (ad==2) {
url="http://www.frontpagewebwizard.com/webtools/counter/index.php";
alt="The World's Best Counters - Frontpagewebwizard.com";
banner="http://images.frontpagewebwizard.com/frontpagewebwizard/
images/affiliate/br2.gif";
width="468";
height="60";
}
if (ad==3) {
url="http://www.frontpagewebwizard.com/webtools/forum/index.php";
alt="The World's Best Forums - Frontpagewebwizard.com";
banner="http://images.frontpagewebwizard.com/frontpagewebwizard/
images/affiliate/br8.gif";
width="468";
height="60";
}
document.write('<center>');
document.write('<a href="' + url + '" target="_blank">');
document.write('<img src="' + banner + '" width='+ width + '
height=' + height + ' alt="' + alt + '" border=0><br>');
document.write('</center>');
</script>
Below is the simple javascript include script that you would place
on any of your webpages that you want the banners to appear. Once
this script is on your pages, all you need to do is modify the
banner.js file that you created above, and those changes will be
automatically effective on every page that the include script is on.
<script language="JavaScript" src="banner.js"></script>
|