我用this.setAttribute('animation-play-state','running');为什么动画不会暂停呢?
window.onload=function(){ var music=document.getElementById('music').getElementsByTagName('img')[1]; var audio=document.getElementsByTagName('audio')[0]; music.onclick=function(){ if (audio.paused) { audio.play(); //this.style.animationPlayState='running'; this.setAttribute('animation-play-state','running'); }else { audio.pause(); //this.style.animationPlayState='paused'; this.setAttribute('animation-play-state','paused'); } } }