xxxxxxxxxx
<html>
<head>
<meta charset="utf-8">
<title>高手教程(study.p2hp.com)</title>
</head>
<body>
<audio id="myAudio">
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
您的浏览器不支持 audio 与元素。
</audio>
<p>点击按钮播放后暂停音频。</p>
<button onclick="playAudio()" type="button">播放音频</button>
<button onclick="pauseAudio()" type="button">暂停音频</button>
<script>
var x = document.getElementById("myAudio");
function playAudio()
{
x.play();
}
function pauseAudio()
{
x.pause();
}
</script>
</body>
</html>