3)Write a JavaScript to create an image slider.(Use array to store
images)
<html>
<script language="JavaScript">
var i = 0;
var path = new Array();
// LIST OF IMAGES
path[0] = "index.jpg";
path[1] = "index1.jpg";
path[2] = "index2.jpg";
function swapImage()
{
document.slide.src = path[i];
if(i < path.length - 1) i++; else i = 0;
setTimeout("swapImage()",1000);
}
window.onload=swapImage;
</script>
<img height="200" name="slide"
src="index.jpg" width="400" />
</html>