Audio from video continues to play in background in IE

Discussion in 'JavaScript' started by KDragon, Feb 22, 2007.

  1. #1
    Basically I created a couple of functions that reference divs that contain embedded videos. One of the functions cycles through the videos according to their id and changes their display to none and then the other function references the particular video that I want displayed according to the link and changes that div's display to block so that it shows up. These functions work great in Firefox and behave as expected, that is, when i click the next link the next video shows up and the video that was displayed previously is gone, meaning that no audio or video is playing anymore. Unfortunately in IE, when I click the link for the video I want, the video I was viewing previously still has it's audio playing in the background. I don't quite understand why this happens and I was just hoping that somebody could help me out.

    Here are the funtions:

    var numVideos=14; 
    
    function HideContent() {
    var name="video"
    var i;
    for(i=1; i<numVideos+1; i++){
      var specName=name+i;
      document.getElementById(specName).style.display = "none";
      }
    }
    function ShowContent(d) {
    if(d.length < 1) { return; }
    document.getElementById(d).style.display = "block";
    }
    Code (markup):
    Here's an example div with the embedded video:

    <div class="videoHolder" id="video1">
    		         <!-- Put embedded video code here --><embed wmode="transparent" src="url of video" quality="high" width="320" height="256" name="movie" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></div>
    Code (markup):
    And here's an example link that calls the functions:


    <a href="javascript:HideContent();ShowContent('video1');" class="videoLink">2/21/07</a>
    Code (markup):
     
    KDragon, Feb 22, 2007 IP