Multi or Random Banner Ad Rotator Script If you have limited space on your Website or Blog, but you want to display multiple banners, the easiest way to show your ads is to rotate t...
2018-07-31T07:44:57Z

Multi or Random Banner Ad Rotator Script

If you have limited space on your Website or Blog, but you want to display multiple banners, the easiest way to show your ads is to rotate the banners based on a random chance or a specific algorithm.

Banner Ad Rotator

This banner rotator is a little bit different from loading one banner to other banner. Don't needed to Refresh the page to see new Ad banners. This Multi or Random Banner Ad Rotator Script is automatically change your banner.

Live Demo



Multi or Random Banner Ad Rotator Script


You can just place this below code, where you want to display multiple banners.
<script type="text/javascript">
/**
* Name    : Banner Ad Rotator 
* Publisher: HowlMeFlash
* URL: http://www.howlmeflash.com/2018/02/multi-or-random-banner-ad-rotator-script.html
**/

function Banner(refreshTime, width, height, altText, start, random){
 this.objName = "bannerAd" + (Banner.count++);
 eval(this.objName + "=this");
 if (!refreshTime) this.refreshTime = 5000; else this.refreshTime = refreshTime*1000;
 if (!width) this.width = 460; else this.width = width;
 if (!height) this.height = 68; else this.height = height;
 if (random == null) this.random = 1; else this.random = random;
 this.altText = altText;
 this.ads = [];
 if (start) this.currentAd = start-1; else start = null;
 this.mySize = 0;

 this.Ad = function(src, href, target, mouseover) {
  var tempImage = new Image();
  tempImage.src = src;
  this.ads[this.mySize] = new Object();
  var ad = this.ads[this.mySize];
  ad.src = src;
  if (typeof(target) == "undefined" || target == null) ad.target = "_self"; else ad.target = target;
  ad.href = href;
  ad.mouseover = mouseover;
  this.mySize++;
 }

 this.link = function(){
  var ad = this.ads[this.currentAd];
  if (ad.target == "_self"){
   location.href = ad.href;
  }
  else if (ad.target == "_blank" || ad.target == "_new"){
   open(ad.href,this.objName + "Win");
  }
  else top.frames[ad.target].location.href = ad.href;
 }

 this.showStatus = function(){
  var ad = this.ads[this.currentAd];
  if (ad.mouseover) status = ad.mouseover;
  else status = ad.href;
 }

 this.randomAd = function(){
  var n;
  do { n = Math.floor(Math.random() * (this.mySize)); } 
  while(n == this.currentAd);
  this.currentAd = n;
 }

 this.output = function(){
  var tempCode = "";
  if (this.mySize > 1){
   if (this.currentAd == null) this.randomAd();
   if (this.currentAd >= this.mySize) this.currentAd = this.mySize - 1;
   tempCode = '<a href="javascript:'+this.objName+'.link();"';
   tempCode += ' onMouseOver="' + this.objName + '.showStatus(); return true"';
   tempCode += ' onMouseOut="status=\'\';return true">';
   tempCode += '<img src="' + this.ads[this.currentAd].src + '" width="' + this.width;
   tempCode += '" name="' + this.objName + 'Img" height="' + this.height + '" ';
   if (this.altText) tempCode += 'alt="'+this.altText + '" ';
   tempCode += 'border="0" /></a>';
   document.write(tempCode);
   this.nextAd();
  } else document.write("Error: two banners must be defined for the script to work.");
 }

 this.newAd = function(){
  if (!this.random){ 
   this.currentAd++;
   if (this.currentAd >= this.mySize)
      this.currentAd = 0;
  }
  else {
   this.randomAd();
  }
  this.nextAd();
 }

 this.nextAd = function(){
  document.images[this.objName+ 'Img'].src = this.ads[this.currentAd].src;
  setTimeout(this.objName+'.newAd()',this.refreshTime)
 }
}
Banner.count = 0;
</script>
<script type="text/javascript">
// Banner Ad Rotator
// Publisher: HowlMeFlash
// URL: http://www.howlmeflash.com/2018/02/multi-or-random-banner-ad-rotator-script.html
<!--
myAd = new Banner( 8, 468, 60, "Visit our sponsor", 1, 0 );
myAd.Ad( "https://hitleap.com/assets/banner-241ef1f2c690b6812aeeff6c0fb91f39ffc8a214c0b2c6c11d8a96f7c98b8fab.png", "https://hitleap.com/by/clonemaster", "_blank", "Increase Website Traffic" );
myAd.Ad( "http://revenuehits.com/publishers/media/img/v2/468x60_v2.gif", "http://www.revenuehits.com/lps/pubref/?ref=@RH@5WvjQBPtIFg", "_blank", "Best Adsense Alternative" );
myAd.Ad( "http://www.10khits.com/banners/468x60.png", "http://www.10khits.com/?ref=155244", "_blank", "Free website traffic to your site" );
myAd.Ad( "https://www.linkcollider.com/img/lcbanner_468x60.jpg", "https://www.linkcollider.com/page/register?r=136953&aff=1", "_blank", "Best SEO Booster" );
myAd.Ad( "https://cdn.adf.ly/images/banners/adfly.468x60.1.gif", "http://adf.ly/?id=2882178", "_blank", "AdFly" );
myAd.Ad( "http://i57.servimg.com/u/f57/17/34/91/86/usersf10.png", "https://usersfiles.com/free2000.html", "_blank", "UsersFiles" );
myAd.Ad( "http://rapidgator.net/images/pics/503_468x60.gif", "http://rapidgator.net/account/registration/ref/1196468", "_blank", "Rapidgator" );
myAd.Ad( "http://i57.servimg.com/u/f57/17/34/91/86/tusfil10.png", "http://www.tusfiles.net/free68334.html", "_blank", "TusFiles" );
myAd.output();
// -->
</script>

MAKE THE FOLLOWING CHANGES OF 2ND SCRIPT:-

* Number of Banner :- 8

* Replace 1st Link with the Image links of the Advertiser’s banners
* Replace 2nd Link with the website link of the advertiser
* _blank to open a new tab for your browse with the website link of the advertiser
* Replace Text with some information related to the Ad. The description appears on mouse hover.

Note : This script I example only 8 banner, you can add much more banner. Just modify 2nd script 1st line and add link same as show on 2nd line.

How to Add Multi or Random Ad Banner Widget to Your Blogger blogspot Blogs


Simply follow these steps
1. Go To Blogger > Design > Page Elements
2. Choose HTML/JavaScript Widget
3. And Paste the following code inside it
4. Save.
That's all, you successfully added Multi or Random Banner Ad Rotator Script
So this was our guide on How to add or use Multi or Random Banner Ad Rotator Script, I hope the methods given above helped you.
Share it:

Blogging

Make Money Online

Post A Comment:

0 comments: