fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> </head> <body> <audio id="myAudio" controls> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> 你的浏览器不支持audio 元素。 </audio><br> <button onclick="enableLoop()" type="button">允许循环播放</button> <button onclick="disableLoop()" type="button">禁止循环播放</button> <button onclick="checkLoop()" type="button">检查循环状态</button> <script> var x = document.getElementById("myAudio"); function enableLoop(){ x.loop = true; x.load(); } function disableLoop(){ x.loop = false; x.load(); } function checkLoop(){ alert(x.loop); } </script> </body> </html>
运行结果