<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.7.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>