<div class="codetitle"> <span><a style="CURSOR: pointer" data="27851" class="copybut" id="copybut27851" onclick="doCopy('code27851')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code27851"> <br><script type="text/javascript" src="jquery-1.%20.2.min.js"></script> <br><script type="text/javascript"> <BR>$(function(){ <BR>//這裡參考了以下兩個站點的介紹<BR>//http://www.w3school.com.cn/html/html_audio.asp <BR>//http://www.zhanxin.info/development/2013-05-17-html5-audio.html <BR>if($.browser.msie && $.browser.version=='8.0'){ <BR>//本來這裡用的是<bgsound src="system.wav"/>,結果IE8不播放聲音,於是換成了embed <BR>$('#newMessageDIV').html('<embed src="system.wav"/>'); <BR>}else{ <BR>//IE9 ,Firefox,Chrome皆支援<audio/> <BR>$('#newMessageDIV').html('<audio autoplay="autoplay"><source src="system.wav"' <BR> 'type="audio/wav"/>< source src="system.mp3" type="audio/mpeg"/>'); <BR>} <BR>}); <BR></script> <br><br><div id="newMessageDIV" style="display:none"></div> <br> </div>