Javascripts > Javascript Images > Automatically Changing Slide Show Script
Script Title: Automatically Changing Slide Show Script
Description: This script is similar to the Slide Show Script, but it automatically changes the image for the user.
Example: Available
Copy the following code into your <HEAD></HEAD> tags.<script language="JavaScript1.1"> <!-- /* JavaScript Image slideshow: By Website Abstraction (www.wsabstract.com) and Java-scripts.net (www.java-scripts.net) */ var slideimages=new Array() var slidelinks=new Array() function slideshowimages(){ for (i=0;i<slideshowimages.arguments.length;i++){ slideimages[i]=new Image() slideimages[i].src=slideshowimages.arguments[i] } } function slideshowlinks(){ for (i=0;i<slideshowlinks.arguments.length;i++) slidelinks[i]=slideshowlinks.arguments[i] } function gotoshow(){ if (!window.winslide||winslide.closed) winslide=window.open(slidelinks[whichlink]) else winslide.location=slidelinks[whichlink] winslide.focus() } //--> </script>
Copy the following code between the <BODY></BODY> tags of your html page.<a href="javascript:gotoshow()"><img src="img1.gif" name="slide" border=0></a> <script> <!-- //configure the paths of the images, plus corresponding target links slideshowimages("img1.gif", "img2.gif", "img3.gif") slideshowlinks("http://wsabstract.com", "http://dynamicdrive.com", "http://java-scripts.net") //configure the speed of the slideshow, in miliseconds var slideshowspeed=2000 var whichlink=0 var whichimage=0 function slideit(){ if (!document.images) return document.images.slide.src=slideimages[whichimage].src whichlink=whichimage if (whichimage<slideimages.length-1) whichimage++ else whichimage=0 setTimeout("slideit()",slideshowspeed) } slideit() //--> </script>
Enter your name and email address to have this script sent right to your Inbox for later viewing. First Name Last Name Email