title: javascript: Uncaught TypeError: Cannot read property 'Play' of undefined
body: <p>I have a fiew movie in my website and I cant play movie.</p>
  
  <p>This is code in java. I send name of video id to javascript:</p>
  
  <pre><code>for(int i=1; i&lt;=Integer.parseInt(film[0][0]); i++)
           {
  
               nr="id"+Integer.toString(i);
               printWriter.print("&lt;input type='hidden' id=\""+nr+"\" name='numerId' value='"+film[i][0]+"' /&gt;");
  
           }
  </code></pre>
  
  <p>This is code in javascript:</p>
  
  <pre><code>var test2=[];
  var test3=[];
  var myVideoTab= new Array();
  for(i = 1; i &lt; size; i++){
  test2[i]='id'+i;
  test3[i]=document.getElementById(test2[i]).value;
  myVideoTab[i]= document.getElementById(test3[i]);
  setTimeout(function () {myVideoTab[i].Play();}, 1000); //in this line is error
  </code></pre>
  
  <p>This is the error: Uncaught TypeError: Cannot read property 'Play' of undefined.
  If i set</p>
  
  <pre><code>   myVideoTab1= document.getElementById(test3[i]);
     setTimeout(function () {myVideoTab1.Play();}, 1000);
  </code></pre>
  
  <p>it work but only one video play</p>