Link to home
Start Free TrialLog in
Avatar of danielledenton
danielledenton

asked on

Onclick events are getting ignored in IE8 standard

I have written code that display a video on the left and links on the right that changes what video is displayed.  I am switching the videos out using javascript onclick events that calls my javascript function.  The function simply hides or displays the video with a  document.getElementById('').style.display = "none"; or  document.getElementById('scheduling').style.display = "";
The code works fine in all browsers and versions except IE8.  I am not seeing any errors in the developer tools either.  The videos just don't appear.

Here is some snippets of my code:
Video Player Code:
 <div id="videocenter">
		<video id="fourKeys"  controls preload="none" poster="mockpic.jpg" tabindex="0" width="512px" height="288px" style="display:''">
			 <source src="mockvideo.mp4" type="video/mp4" />
			 <source src="mockvideo.webm" type="video/webm" />
			 <object width="512px" height="288px" type="application/x-shockwave-flash" data="salescontent/flash/flowplayer/flowplayer-3.2.8.swf">
			 	<param name="movie" value="../../flash/flowplayer/flowplayer-3.2.8.swf" />
			 	<param name="allowScriptAccess" value="sameDomain"></param>
			   <param name="allowFullScreen" value="true" />
			   <param name="wmode" value="transparent" />
			   <param name="flashVars" value="config={'clip':{'url':'mockvideo.mp4','autoPlay':false, 'autoBuffering':true}}" />
			 </object>
			</video>
		</div><!-- videocenter -->
    
     <!--Two Traps to Avoid With Potential Clients - Part 1 -->
  <div id="videocenter">
		<video id="twoTraps_pt1"  controls preload="none" poster="mockpic2.jpg" tabindex="0" width="512px" height="288px" style="display:none">
			 <source src="mockvideo2.mp4" type="video/mp4" />
			 <source src="mockvideo2.webm" type="video/webm" />
			 <object width="512px" height="288px" type="application/x-shockwave-flash" data="salescontent/flash/flowplayer/flowplayer-3.2.8.swf">
			 	<param name="movie" value="../../flash/flowplayer/flowplayer-3.2.8.swf" />
			 	<param name="allowScriptAccess" value="sameDomain"></param>
			   <param name="allowFullScreen" value="true" />
			   <param name="wmode" value="transparent" />
			   <param name="flashVars" value="config={'clip':{'url':'mockvideo2.mp4','autoPlay':false, 'autoBuffering':true}}" />
			 </object>
			</video>
		</div><!-- videocenter -->

Links to switch between videos:
 <ul>
      <li><a href="javascript:void(0);" onClick="showVideo('fourKeys');">Four Key Steps of the Financial Planning Process</a></li>
      <li><a href="javascript:void(0);" onClick="showVideo('twoTraps_pt1');">Two Traps to Avoid With Potential Clients - Part 1</a></li>
       <li><a href="javascript:void(0);" onClick="showVideo('twoTraps_pt2');">Two Traps to Avoid With Potential Clients - Part 2</a></li>
      <li><a href="javascript:void(0);" onClick="showVideo('attaining');">Attaining Need Awareness by the Client</a></li>
   </ul> 

Javascript Function:
<script language="javascript" type="text/javascript">
      function showVideo(varVideo){
        document.getElementById('fourKeys').style.display = "none";
    
        document.getElementById('twoTraps_pt1').style.display = "none";
  
        document.getElementById('twoTraps_pt2').style.display = "none";
        
        document.getElementById('attaining').style.display = "none";
       
        
        document.getElementById(varVideo).style.display = "";
    
      }
      
    </script>

Open in new window

Avatar of Gary
Gary
Flag of Ireland image

Guessing you need to declare a display mode

document.getElementById(varVideo).style.display = "block";
Avatar of danielledenton
danielledenton

ASKER

Thanks for the help Gary but the video player is still not displaying.
It was just a guess, do you have a link to the page?
Actually try this change to your links

<li><a href="#" onClick="return showVideo('attaining');">Attaining Need Awareness by the Client</a></li>

In your function add this as the last line

return false;
The html5 video tag does not work with Internet Explorer 8.
D'oh
Good catch on the HTML5 video tag.
@Gary : I thought the provided article showed a possible solution to the problem in order to help the author and therefore was valid... sorry
Do you have an example of a video tag that does work with IE8?
You already have a fallback to flash in your code for browsers that don't support HTML5
Can you give a link to the page?
I am able to get the video player to display but now I am getting a 200, Stream not found, NetStream.Play.StreamNotFound - even though the file is where the path is referencing.
In this bit
'url':'mockvideo.mp4'

Amend the path to the full URL.

Also make sure you have the latest version of Flash.

How many of your users are actually using IE8 - it's current worldwide usage is just over 5% and dropping about 0.5% every month
It may be time to tell your visitors then you no longer support obsolete browsers (which IE8 is)
ASKER CERTIFIED SOLUTION
Avatar of danielledenton
danielledenton

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Tried but didn't succeed.