html5 audio
<audio> 标签定义声音,比如音乐或其他音频流。
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <button onclick="playVid()" type="button">1播放/暫停</button> <audio id="audio1" controls="controls"> <source src="http://webuzz.things.buzz/update_pic/music/fast_men_fast_wemen.mp3" type="audio/mp3"> </audio> <script> var myVideo = document.getElementById("audio1"); function playVid() { if (myVideo.paused) { myVideo.play(); myVideo1.pause(); } else { myVideo.pause(); } } </script> </body> </html>
簡單實現了btn audio暫停播放