Random Banner Ad Shown

[Total: 0    Average: 0/5]

Show different banner (ad) based upo the time at which the page was loaded.

Body Code:

<script LANGUAGE="JavaScript">
// !!! Reload page
// add 1,2,3 'img'
var NumberOfAds = 4;
var now = new Date()
var sec = now.getSeconds()
var AdNumber = sec % NumberOfAds;
AdNumber +=1;

if (AdNumber==1)

{

 url="http://www.js-examples.com/";
 Graphic="/js/images/pic1.gif";
 width = "220"
 height = "40"

}

if (AdNumber==2)

{

 url="http://www.js-examples.com/";
 Graphic="/js/images/pic2.gif";
 width = "220"
 height = "40"

}
if (AdNumber==3)

{

 url="http://www.js-examples.com/";
 Graphic="/js/images/pic3.gif";
 width = "268"
 height = "50"

}
if (AdNumber==4)

{

 url="http://www.js-examples.com/";
 Graphic="/js/images/pic4.gif";
 width = "220"
 height = "40"

}


document.write('<center>');
document.write('<a href="' + url + '">');
document.write('<img src="' + Graphic + '" width=')
document.write(width + ' height=' + height + ' ');
document.write('border=0><br>');
document.write('</a>');
document.write('</center>');


</script>

<br>
<center>REST OF HTML  DOCUMENT HERE
<br><b><font color=red>Type reload some times, You will see change</font>

Times Viewed: 7

Leave a Reply

Your email address will not be published. Required fields are marked *