Hi....
i am creating a website and on home page i want to rotate different images randomly,by the code given below i am able to rotate image at one place but i want to rotate image at more than one different places with different images. like this
[1] [1] [1]
[2] [2] [2]
[1] and [2] are the places for image
Please help....
<SCRIPT LANGUAGE="JavaScript">
<!--
var dimages=new Array();
var numImages=11;
for (i=0; i<numImages; i++)
{
dimages[i]=new Image();
dimages[i].src="images/image"+(i+1)+".jpg";
}
var curImage=-1;
function swapPicture()
{
if (document.images)
{
var nextImage=curImage+1;
if (nextImage>=numImages)
nextImage=0;
if (dimages[nextImage] && dimages[nextImage].complete)
{
var target=0;
if (document.images.myImage)
target=document.images.myImage;
if (document.all && document.getElementById("myImage"))
target=document.getElementById("myImage");
// make sure target is valid. It might not be valid
// if the page has not finished loading
if (target)
{
target.src=dimages[nextImage].src;
curImage=nextImage;
}
setTimeout("swapPicture()", 2000);
}
else
{
setTimeout("swapPicture()", 500);
}
}
}
//setTimeout("swapPicture1()",1000);
setTimeout("swapPicture()", 2000);
//-->
</SCRIPT>