播放音乐
<html><head>
<meta charset="utf-8"/>
<style>
*{margin: 0;padding: 0}
#碟片{width: 300px;
height: 300px;
background:url(http://p2.so.);30 30 no-repeat;
margin:10px auto;
border-radius:50%;}
.active{animation:move 10s linear infinite ;}
@keyframes move{
0%{transform: rotate(0deg);}
100%{transform: rotate(360deg);}
}
</style>
</head>
<body>
<div id="碟片" class="active"></div>
<audio src="http://vdisk. loop id="音乐" autoplay ></audio>
<div id="tit">田馥甄—小幸运</div>
</body>
<script>
var 音乐=document.getElementById('音乐');
var 碟片=document.getElementById('碟片');
碟片.onclick=function(){
if(this.className=="active"){
this.className="";
音乐.pause();
}
else{
this.className="active";
音乐.play();
}
}
音乐.play();
</script>
</html>