title: Trying to Run Next Previous Button to Play Video From List Media Player Code Giving Error?
body: <p>i am trying to run video from list i have i use two buttons to run next previous videos from list and by default it run first one but it giving me error and i am getting confuse also so i need help to make it run let me tell its my video list code,</p>
  
  <pre><code>    &lt;div&gt;
  &lt;SELECT id=cancion onchange=PlayIt() size=20 name="cancion" style="width: 470; color:#C0C0C0; height:22; background-color:#000000;"&gt;
  &lt;option value=Peace1.wmv&gt;. . Countdown&lt;/option&gt;
  &lt;option value=Fire.wmv&gt;. . Time Crisis 4&lt;/option&gt;
  &lt;option value=Water.wmv&gt;. . Need For Speed&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/assessment.wmv&gt;. . Meli's Video&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/k_0001.wmv&gt;. . Keldin's Video&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/Skateboard_Tricks_Video.wmv&gt;. . Chris's Video&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/video_0001.wmv&gt;. . Salinina's Video&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/JORDAN_MOVES_23.wmv&gt;. . Josh's Video&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/robots_video_0001.wmv&gt;. . Sam's Video&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/Unexpected2.wmv&gt;. . Unexpected&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/By_brendan_wu.wmv&gt;. . Brendan's Video&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/rebecca01.wmv&gt;. . Rebecca's Video 1&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/rebecca_robots002.wmv&gt;. . Rebecca's Video 2&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/robotics_videoo_002.wmv&gt;. . Robotics Video&lt;/option&gt;
  &lt;option value=http://liamalexander.com/computing/gallery/albums/video/joys_01.wmv&gt;. . The Joys of Spring&lt;/option&gt;
  &lt;/SELECT&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>we have two buttons next and previous for switching video,</p>
  
  <pre><code>&lt;button type="button" onclick="showDiv(1 - 1)"&gt;Previous&lt;/button&gt;
  &lt;button type="button" onclick="showDiv(1 + 1)"&gt;Next&lt;/button&gt;
  </code></pre>
  
  <p>now the script that will run on next or previous button,</p>
  
  <pre><code>function showDiv(which) {
  var currentImage = 1;
     for(i = 0; i &lt; 13; i++) {
        //document.getElementById("image"+i).style.display="none";
   document.getElementById("music1").innerHTML='&lt;object id="mediaPlayer" width="470" height="400" '
  +'classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" '
  +'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" '
  +'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"&gt;'
  +'&lt;param name="fileName" value="'+document.getElementById('cancion'+i).value+'"&gt;'
  +'&lt;param name="animationatStart" value="true"&gt;'
  +'&lt;param name="transparentatStart" value="true"&gt;'
  +'&lt;param name="autoStart" value="1"&gt;'
  +'&lt;param name="showControls" value="true"&gt;'
  +'&lt;param name="loop" value="true"&gt;'
  +'&lt;param name="ShowStatusBar" value="true"&gt;'
  +'&lt;param name="ShowPositionControls" value="true"&gt;'
  +'&lt;param name="enableContextMenu" value="1" /&gt;'
  +'&lt;param name="fullScreen" value="0" /&gt;'
  +'&lt;embed type="application/x-mplayer2" '
  +'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" '
  +'bgcolor="darkblue" showcontrols="true" showpositioncontrols="true" showstatusbar="true" showgotobar="true" width="470" height="400" '
  +'src="'+document.getElementById('cancion'+i).value+'" autostart="true" designtimesp="5311" loop="true"&gt;'
  +'&lt;/embed&gt;'
  +'&lt;/object&gt;'
     }
     //in the next 2 lines, you make sure which isn't lower than 1, and isn't greater than the number of images
     if(which &lt; 1) which = 1;
     if(which &gt; 13) which = 13;
     document.getElementById("image" + which).style.display = "block";
     currentImage = which;
  } 
  </code></pre>
  
  <p>i am using three videos "Peace1" "Fire" "Water" you can use any video here you have to check this code </p>
  
  <p>Hopes to listen from you soon thanks in advance </p>