<!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>
转载于:https://www.cnblogs.com/shizhijie/p/7754307.html