使用JS播放聲音——SoundManager 2


<!DOCTYPE html>
<html> <head> <meta charset=utf-8 /> <title>SoundDemo</title> <script type="text/javascript" src="script/soundmanager2-nodebug-jsmin.js"></script> <script type="text/javascript" src="script/jquery-1.10.0.min.js"></script> <script type="text/javascript"> soundManager.setup({ url: 'swf/', //swf文件夾的位置 onready: function() { soundManager.createSound({ id: 'msg', autoLoad: true, autoPlay: false, url: 'sound/msg.mp3' //mp3文件的位置 }); } }); $(document).ready(function () { $('#play').click(function () { soundManager.play('msg'); //點擊按鈕可播放 }); }); </script> </head> <body> <input type='button' id='play' value='Play' /> </body> </html>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM