Write a JavaScript to create an image slider.(Use array to store images)

This is The Project is about How To Write a JavaScript to create an image Slider.(Use Array to store images). Meaning It Consists of an Javascript File Containing The Complete Code how to Write an this Project.


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta
    http-equiv="X-UA-Compatible"
    content="IE=edge">
  <meta
    name="viewport"
    content="width=device-width,
    initial-scale=1.0">
  <title>Document</title>
</head>
<body>
 <script language="JavaScript">
  var i = 0;
  var path = new Array();
     
  // Path of list of Images
  path[0]="image-no-1.gif";
  path[1]="image-no-2.gif";
  path[2]="image-no-3.gif";
    
  function slideImage()
   {
     document.slide.src=path[i];
     if(i < path.length-1)
        i++;
     else
        i = 0;
     setTimeout("slideImage()"
        ,3000);
   }
   window.onload=swapImage;
   </script>
   <img height="200"
       name="slide"
       src="image-no-1.gif"
       width="400"
   />
</body>
</html>




Comments