JavaScript Site Rotator Code
Posted By admin on June 13, 2009
When you need to rotate images on web pages for ads or other images use the code below.
You can create as many image rotations as you want — instructions are below the code
<html>
<head>
<title>JavaScript Site Rotator</title>
</head>
<body>
<script LANGUAGE=”JavaScript”>
<!– Begin
var howMany =5;
var page = new Array(howMany+1);
page[0]=”http://www.x1.com“;
page[1]=”http://www.x2.com“;
page[2]=”http://www.x3.com“;
page[3]=”http://www.x4.com“;
page[4]=”http://www.x5.com“;
page[5]=”http://www.x6.com“;
function rndnumber(){
var randscript = -1;
while (randscript < 0 || randscript > howMany || isNaN(randscript)){
randscript = parseInt(Math.random()*(howMany+1));
}
return randscript;
}
quo = rndnumber();
quox = page[quo];
window.location=(quox);
// End –>
</script>
</body>
</html>
JavaScript Site Rotator Code Instructions
specify the urls of the images in an Array, and the object where the image will be shown.
The function RotateImages is called with the Array/Img Object number, and at what index of the array the rotation should start.
example:
Change http://www.x1.com to your site url and do the similar to all the urls like http://www.x1.com= your first site url
http://www.x2.com = your second site
http://www.x3.com = Your third site….etc.
var howMany = total number of sites you listed minus 1.
If you have any more doubts about how to configure your Rotator, Please contact scripts@dollarsbysafelist.com and we will provide you with the necessary instructions.

