W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>本例演示如何将 "onvolumechange" 事件分配给 audio 元素。</p> <p>请尝试更改右下角的音量。</p> <audio controls onvolumechange="myFunction()"> <source src="/i/horse.ogg" type="audio/ogg"> <source src="/i/horse.mp3" type="audio/mpeg"> Your browser does not support the audio element. </audio> <script> function myFunction() { alert("The volume has been changed!"); } </script> </body> </html>