Monday, November 1, 2010

SWF rotator version of the Ad Rotator script

Earlier I posted a simple script 2 rotate banner ads randomly by javascript.
U can use it 2 place jpgs, gifs & pngs, but 2 place flash files U need some changes 2 B done in them, so I M posting this version 4 placing swf files.
Again this is very simple script & in no way I M sure that it might B appealing 2 U. But it will work & I have tested it on many browsers and it is simple.
So here is D code

// Swf rotator script created by Tanmay Das
// Script © Copyright, Tanmay Das.com
// Visit http://tj4119.blogspot.com/
// Ad your swfs here

// e.g. 'ad1.swf',

// DO NOT PUT a (,) at the end

randomAd(['swf1.swf','swf2.swf','swf3.swf']);

// DO NOT EDIT ANYTHING BELOW

function random(limit){
return Math.floor(Math.random()*limit);
}
function randomSwf(swfArr)
{
var swfSrc, swfW, swfH, r;
r = random(swfArr.length / 1);

swfSrc = swfArr[r * 1];
swfW = 180; // You can change the swf width
swfH = 150; // You can change the swf height
document.write('<embed src='+swfSrc+' width='+swfW+' height='+swfH+' autostart=true loop=true></embed><br>
<a href="www.tj4119.blogspot.com" title="Created By Tanmay Das" target="_blank">Designed By Tanmay Das</a>');
}

No comments:

Post a Comment