Script Categories













Messages >>> Banner Ads.

Need to rotate banner ads on your site? How about doing it in JavaScript! This simple little JavaScript will print out a random banner ad each time your page is viewed.

Add the below code to the <body> section of your page:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var how_many_ads = 2;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % how_many_ads;
ad +=1;
if (ad==1) {
txt="Tour of Duty 71";
url="http://geocities.com/tourofduty71";
alt="tourofduty 71";
banner="tourofduty2.gif";
width="468";
height="60";
}
if (ad==2) {
txt="Tour of Duty 71";
url="http://geocities.com/tourofduty71";
alt="tourofduty 71";
banner="tourofduty2.gif";
width="468";
height="60";
}
document.write('<br><br><center>');
document.write('<a href=\"' + url + '\" target=\"_top\">');
document.write('<img src=\"' + banner + '\" width=')
document.write(width + ' height=' + height + ' ');
document.write('alt=\"' + alt + '\" border=0><br>');
document.write('<small>' + txt + '</small></a>');
document.write('</center>');
// End -->
</script>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©