<!DOCTYPE html> <html> <body> <p>本例使用 HTML DOM 将 "oncanplaythrough" 事件分配给 video 元素。</p> <video controls id="myVideo"> <source src="/static/demo/video/shanghai.mp4" type="video/mp4"> Your browser does not support HTML5 video. </video> <script> document.getElementById("myVideo").oncanplaythrough = function() {myFunction()}; function myFunction() { alert("Can play through video without stopping"); } </script> </body> </html>