title: Javascript next video function
body: <p>I'm trying to create a form of video slideshow. I want to be able to have two buttons that go forward and backward through an array of video sources. Here is what I have so far.</p>
  
  <pre><code>&lt;script&gt;
   var vids = new Array();
  vids[0] = "images/movie1.mp4"
  vids[1] = "images/movie3.mp4"
  
  var i = (vids[0]);
  &lt;/script&gt;
  
  &lt;script&gt;
  function next()
      {
          document.getElementById("myvideo").src=([i]);
          }
  &lt;/script&gt;
  
  &lt;video id="myvideo" width="320" height="240" controls&gt;
  &lt;source src="images/movie1.mp4" type="video/mp4"&gt;
  &lt;/video&gt;
  
  &lt;button type="button" onclick="next()"&gt;try&lt;/button&gt;
  </code></pre>
  
  <p>It seems simple enough, but when I try use functions that increment i by one (i++) it does not select the next video. </p>
  
  <p>Essentially I need someone to help me create a method that makes the variable i move down to the next video of the array. Thanks!</p>