Using an array to change video.src
<p>I've tried to get it to work for a couple of days now, reseached how to do it changed it over and over but it just wont work. Im either stupid or blind. I want to code a simple videoplayer... I thought it was easy enough for starters T_T </p>

<p>This is the html file:               </p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"&gt;
&lt;script language="JavaScript" src="player.js"&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body onkeydown="GetKey()" onload="VideoList()"&gt;

&lt;div style="text-align:center"&gt;
  &lt;img src="images/Magipoka.jpg" onclick="window.location='Magipoka.html'"&gt;
  &lt;img src="images/puni.jpg" onclick="window.location='puni.html'"&gt;
  &lt;br&gt;
  &lt;video id="currentVideo" autoplay="true" preload="auto"    onended="Playnext()"   
 onclick="goFullscreen('currentVideo'); return false" ;=""&gt; 

  &lt;source src="Magipoka.mp4" type="video/mp4"&gt; 
  &lt;source src="Magipoka.ogv" type="video/ogv"&gt; 
  Your browser does not support HTML5 video. 
  &lt;/video&gt;
&lt;/div&gt;

&lt;div style="text-align:center"&gt; 
   &lt;button onclick="LoopToggle()"&gt;Loop&lt;/button&gt;
   &lt;button onclick="LoopToggleOff()"&gt;LoopOff&lt;/button&gt;
   &lt;button onclick="playPause()"&gt;Play/Pause&lt;/button&gt; 
  &lt;/div&gt;
  &lt;script language="JavaScript" src="Body_Scripts.js"&gt;&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>body js file:</p>

<pre><code>var Video=document.getElementById("currentVideo"); 
var VideoCount = 0;
var source = new Array();   


function VideoList(){
    source[0].src = "Magipoka.ogv";
    source[1].src = "puni.ogv";
}

function playPause()
{ 
 if (Video.paused) 
 Video.play(); 
 else 
 Video.pause(); 
}

function LoopToggle(){
  if (Video.ended)
    Video.play();
    if(Video.loop="false")
      video.loop=true;
      else
      video.loop=null;
      }


function Repeat(){
    if(Video.ended)
    Video.paused();
    Video.play();
}

function Playnext(){
 Video.src = source[VideoCount];
    //alert(VideoCount);
VideoCount++;
 alert(source[1]);
}
</code></pre>

<p>header js file:</p>

<pre><code>function goFullscreen(id) {
// Get the element that we want to take into fullscreen mode
var element = document.getElementById(id);

// These function will not exist in the browsers that don't support fullscreen mode yet, 
// so we'll have to check to see if they're available before calling them.

if (element.mozRequestFullScreen) {
  // This is how to go into fullscren mode in Firefox
  // Note the "moz" prefix, which is short for Mozilla.
  element.mozRequestFullScreen();
} else if (element.webkitRequestFullScreen) {
  // This is how to go into fullscreen mode in Chrome and Safari
  // Both of those browsers are based on the Webkit project, hence the same prefix.
  element.webkitRequestFullScreen();
}
// Hooray, now we're in fullscreen mode!
}
//-----------------
function GetKey(e) { var code; if (!e) var e = window.event; if (e.keyCode)
code = e.keyCode; else if (e.which) code = e.which; var character =
String.fromCharCode(code); setTimeout('ShowTree('+code+');',100);
}
function ShowTree(character, a){
if (character == 49){
window.location='puni.html' }
if (character == 50){
window.location='magiPoka.html' }
}
</code></pre>
