标签:repeat load control 控制 cti body 音频 rip reload
<body>
<audio src="b.mp3" controls="controls" preload id="music" hidden>
</audio>
<span onclick="control();">播放/暂停</span>
<span onclick="repeat();">重播</span>
<script>
function repeat(){
var audio = document.getElementById(‘music‘);
audio.currentTime = 0;//重新播放
}
function control(){
var audio = document.getElementById(‘music‘);
if(audio!==null){
if(audio.paused){
audio.play();// 播放
}else{
audio.pause();// 暂停
}
}
}
</script>
</body>
标签:repeat load control 控制 cti body 音频 rip reload
原文地址:http://www.cnblogs.com/bella-lin/p/7808514.html