W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <p>本例使用 HTML DOM 将 "onplaying" 事件分配给 video 元素。</p> <p>播放、暂停然后再次播放视频。</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").onplaying = function() {myFunction()}; function myFunction() { alert("The video is now playing"); } </script> </body> </html>