2012-12-05 50 views
0

我不能在我的生活中使音頻標籤在IE9中工作。這是我的代碼,我究竟做錯了什麼?我確信我的標籤都是按順序排列的,我強制要求IE9使用HTML5。在此先感謝您的幫助。音頻標籤在IE9中不起作用

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8"> 
     <title>CD Cover Animation</title> 

    <script type="text/javascript" src="js/animCD.js?rev=new"></script>  
    <link rel="stylesheet" href="style.css" type="text/css" /> 

    <!-- Show Audio when button is clicked --> 

    <script type="text/javascript"> 
     function showAudio() 
     { 
      document.getElementById('audioInterview').style.visibility='visible'; 
     } 
    </script> 

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 

    </head> 
    <body> 

    <video autoplay="autoplay" id="videoBackground" width="1280" height="720" preload="auto" ontimeupdate="animCD_onprogress();"> 
     <source id="colorVid_mp4" type="video/mp4" src="img/luther-2.mp4"> 
     <source id="colorVid_ogg" type="video/ogg" src="img/luther-2.ogg"> 
    </video> 


     <audio id="audioInterview" preload='auto' controls style="visibility:hidden" 
      <source src="audio/interview.mp3" type="audio/mp3"> 
     Your browser does not support the audio element. 
     </audio> 


    <!-- <div class="buttonSkip" onclick="alert('Clicked Skip');"></div> --> 



    <p><a class="ex2" href="http://www.lrltv.org/muslims-nuclear.html">[ skip intro]</a></p> 

    <div id="buttonPlacement" class="buttonPlacement"> 
     <div onclick="showAudio();" class="btnDonate"></div> 
     <div onclick="alert('Clicked Buy');" class="btnBuy"></div> 
    </div> 
      <!-- Add more buttons here --> 

    </body> 
</html> 
+3

關於關閉'audio'標籤如何? – robertc

+0

你沒有關閉音頻標籤,它看起來像設置preload =「auto」而不是preload ='auto'來保持一致性會更好。 –

回答

0

喜歡的評論說。您需要關閉音頻標籤。但他們並不意味着</audio>,而是>在行尾。它應該是這樣的:

<audio id="audioInterview" preload="auto" controls="controls" style="visibility:hidden"> 
     <source src="audio/interview.mp3" type="audio/mp3"> 
     Your browser does not support the audio element. 
</audio> 

我也使用控件=「控制」

如果你不需要顯示音頻控制,你也爲此在純JavaScript。

var audioInterview = new Audio('audio/interview.mp3'); 
audioInterview.play(); 

,然後刪除HTML音頻標籤