<div id="musical"> <img src="img/music1.png" alt="" width="100px" height="100px" onClick="myFun();" id="musicImg"> <audio id="music" src="audio/伦桑 - 山有木兮.mp3" loop autoplay></audio> </div>
//控制封面音乐播放的暂停和继续播放 var flag =false; function myFun() { var audio = document.getElementById('music'); if (!flag) { audio.pause(); document.getElementById('musicImg').src = "img/music1.png"; flag = true; } else { audio.play(); document.getElementById('musicImg').src = "img/music1.png"; flag = false; }}