PDA

View Full Version : How to rotate various advertisements?


AFemaleProdigy
03-27-2011, 02:42 PM
Hello,

I am using the advertisement hooks and also widgets to display advertisements in my forum. However, it only allows me to display one static ad. There is no option that I can see to rotate multiple ads based on a certain amount of time displayed. Does anyone know how I might go about implementing this idea?

There was a mod for older versions of vB (back before the cms came along), that would do this. I can't seem to find one for vb4.

Example:

I have ads A, B, and C. I want to display each ad for 5 seconds, then switch to the next ad.

Thanks!

Videx
03-28-2011, 11:55 PM
I use Rotating Banner System (https://vborg.vbsupport.ru/showthread.php?t=188328) , though I don't think it rotates banners without a page refresh (which would cause load even for idle users).

Stefan118
03-29-2011, 11:54 PM
Simple script for rotating banners. This rotates the banners by each refresh of the page.
You can place this in the advertisement area.

I agree with Videx.
Rotating every 5 seconds isn't wise to do.

<script language="JavaScript">

images = new Array(4);

images[0] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.PlaceWhereTheBannerIsStored.gif' alt='Hover text'></a>";
images[1] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.PlaceWhereTheBannerIsStored.gif' alt='Hover text'></a>";
images[2] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.PlaceWhereTheBannerIsStored.gif' alt='Hover text'></a>";
images[3] = "<a href = 'http://www.LinkToBannersWebsite.com target=_new><img src='http://www.PlaceWhereTheBannerIsStored.gif' alt='Hover text'></a>";

index = Math.floor(Math.random() * images.length);
document.write(images[index]);

</script>

pransis
04-03-2011, 12:48 PM
You can also use Google's Ad Manager or install OpenX on your hosting box.