<!DOCTYPE html>
<html>
<head>
<title>JavaScript Image Slide show Demo </title>
</head>
<body>
<div>
<img id="csdt" width="600px" height="400px" />
</div>
<script>
var imgArray = ['pic1.jpg','pic2.png','pic3.png'],
indexPosition = 0; //for array index starting value
imgIntervalDuration = 3000; // for image replacement time duration.. 1000 mili sec is equal to 1 sec.
function imageSlideShow() //Function definition
{
document.getElementById('csdt').src = imgArray[indexPosition];
indexPosition++;
if (indexPosition == imgArray.length)
{
indexPosition = 0;
}
setTimeout("imageSlideShow()", imgIntervalDuration);
}
imageSlideShow(); //Function calling
</script>
</body>
</html>