PDA

View Full Version : Ads rotator



abhijeet_dighe
08-01-2009, 10:00 AM
Hi

I am looking for a javascript ads rotator which can rotate plain text or link or image or
3rd party scripts (like adsense)

My script is working for plain text, link, image.
But its not working for 3rd party scripts.

This is sample code:


<html>
<head></head>
<body>
<layer id="placeholderlayer"></layer>
<span id="placeholderdiv"></span>
<script language="JavaScript">
var delay = 4; //seconds
var current = 0; //counter
var ns6 = document.getElementById&&!document.all; //detect netscape 6

var items = new Array();
items[0]="<img src=http://i264.photobucket.com/albums/ii185/zizw2/newyear/14.gif alt=new year border=0/>";
items[1]="This is a plain text";
items[2]="<a href='http://google.com'>This is a link</a>";
items[3]="<script src='http://voap.weather.com/weather/oap/USTX0821?template=GENXV&par=1004392577&unit=0&key=0a77fd35bb9f42a7083b3c276e66b348'><\/script>";

function rotater()
{
if(document.layers)
{
document.placeholderlayer.document.write(items[current]);
document.placeholderlayer.document.close();
}

if(ns6)
document.getElementById("placeholderdiv").innerHTML=items[current]
if(document.all)
placeholderdiv.innerHTML=items[current];
current = (current==items.length-1) ? 0 : current + 1; //increment or reset
setTimeout("rotater()",delay * 1000);
}
</script>
<script type="text/javascript" language="JavaScript">rotater();</script>

</body>
</html>

In the above script item 0,1,2,3 corresponds to image, plain text, link and weather script respectively.
Script is rotating these items but weather script is displayed as blank in rotation.



Please let me know how to solve this issue.

-Abhijeet