HTML中多页面实现背景音乐的连续播放源码
时间: 2023-05-29 08:04:49 浏览: 333
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<audio id="myAudio" loop>
<source src="music.mp3" type="audio/mpeg">
<source src="music.ogg" type="audio/ogg">
</audio>
<button onclick="playAudio()">Play Audio</button>
<button onclick="pauseAudio()">Pause Audio</button>
<script>
var x = document.getElementById("myAudio");
function playAudio() {
x.play();
}
function pauseAudio() {
x.pause();
}
</script>
</body>
</html>
阅读全文