I am currently having problem displaying multiple images using only one `img` tag and whose `src` is changed continuously. Here is my code:

```
<script>
  var i=0;

  function swapImage() {
    document.slide.src = 'image'+i+'.jpg';

    i++; 
    setTimeout('swapImage()',3000);
  }

</script>
<img class='materialboxed' width='350px' height='250px' src='CCTV.jpg' name='slide'>

```

But my code only displays one image then shows it in a kind of slideshow but rather i want to display all of them at once in a kind of for and while loop if possible.