Forum Moderators: open
I have found one recently, but I took out the url array and loop that takes care of the url swapping, since I only needed one url.
I have too sign off for the weekend, so I am just giving you the code I got left and leave it to you to put the url swapping functionality back in.
Oh yeah, I found it via an ordinary search for 'image swapping javascript'.
var dimages=new Array();
for (i=0; i<5; i++){
dimages[i]=new Image();
dimages[i].src="img/promo1/image"+(i+1)+".gif";
}
var curImage=-1;
function swapPicture(){
var nextImage=curImage+1;
if (nextImage>=5) nextImage=0;
target=document.getElementById("myImage");
target.src=dimages[nextImage].src;
curImage=nextImage;
setTimeout("swapPicture()", 3000);
}
setTimeout("swapPicture()", 3000);
You might also use the below code amending this line:
msgs[count]="<a href=\"path.htm\" title=\"link to Contact\">"+msgs[count]+"</a>";
in particular.
var msgs=new Array("Join the Forum","Apply for newsletters","Contact us now");
var count=0;
var timer=1000;
document.write("<div id=\"msg\" ></div>");
function SlideText(){
if (count>=3) count=0;
msgs[count]="<a href=\"path.htm\" title=\"link to Contact\">"+msgs[count]+"</a>";
var enigma=(document.all)? msg:document.getElementById("msg");
enigma.innerHTML=msgs[count];
count=count+1;
setTimeout("SlideText()",timer);
timer=timer+1000;
}
setTimeout("SlideText()",timer);
Good luck.
I'll take a look at the code a little later myself as time is not a luxury right now. :-\