Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple JavaScript/HTML Slideshow [closed]

New to Javascript, but after some research it loks like this would be the best method in implementing my desired output. I'm trying to produce a slideshow of images (5 pre-selected images) that automatically change between 5 second intervals. Can anyone point towards a tutorial or guide me along in this process? Any help is very much appreciated.

like image 907
TopChef Avatar asked Sep 26 '11 22:09

TopChef


1 Answers

Here is a Very simple code to create simple JavaScript/HTML slideshow only by using simple JavaScript and HTML codes :

<script language="JavaScript"> 
var i = 0; var path = new Array(); 

// LIST OF IMAGES 
path[0] = "image_1.gif"; 
path[1] = "image_2.gif"; 
path[2] = "image_3.gif"; 

function swapImage() 
{ 
document.slide.src = path[i]; 
if(i < path.length - 1) i++; 
else i = 0; 
setTimeout("swapImage()",3000); 
} 
window.onload=swapImage; 
</script> 
<img height="200" name="slide" src="image_1.gif" width="400" />
like image 144
2 revs, 2 users 94% Avatar answered Sep 22 '22 11:09

2 revs, 2 users 94%