HTML 音乐
作者:互联网
<audio preload autoplay loop id="vd"> <source src="/static/audio/hua.mp3" type="audio/mpeg"> </audio> <script> {{-- 音乐--}} window.onload = function(){ setInterval("toggleSound()",100); } function toggleSound() { var music = document.getElementById("vd");//获取ID if (music.paused) { //判读是否播放 music.paused=false; music.play(); //没有就播放 } } </script>
标签:function,--,toggleSound,音乐,paused,HTML,music,播放 来源: https://www.cnblogs.com/xiaoyantongxue/p/15894309.html