Write a JavaScript program to create image slideshow.
Create a slideshow with the group of four images, also simulate the next and previous transition between slides in your JavaScript.
<html>
<head>
<title>Image SlideShow</title>
<script>
var images = ["01.jpg", "02.jpg", "03.jpg", "04.jpg", "05.jpg"];
var count = 0;
function previousImage()
{
if(count!=0)
count--;
var id = document.getElementById("imageId");
id.src = "images/" + images[count];
}
function nextImage() {
if(count!=4)
count++;
var id = document.getElementById("imageId");
id.src = "images/" + images[count];
}
</script>
</head>
<body>
<center>
<img id="imageId" src="images/01.jpg" width="300" height="200"/><br/>
<hr>
<input type="button" value="< Prev Image" onclick="previousImage()"/>
<input type="button" value="Next Image >" onclick="nextImage()"/>
</center>
</body>
</html>
