W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>本例使用 addEventListener() 方法将 "pause" 事件附加到 video 元素。</p> <p>Play and pause the video.</p> <video controls id="myVideo"> <source src="/i/photo/shanghai.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video> <script> document.getElementById("myVideo").addEventListener("pause", myFunction); function myFunction() { alert("The video was paused"); } </script> </body> </html>