<html>
<body>
<audio id="myAudio" controls autoplay>
<source src="/demo/horse.ogg" type="audio/ogg">
<source src="/demo/horse.mp3" type="audio/mpeg">
您的浏览器不支持 audio 元素。
</source></source></audio>
<p>点击按钮查看音频的网络状态。</p>
<p id="demo"></p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction()
{
var x = document.getElementById("myAudio").networkState;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>