x
 
<!DOCTYPE html>
<html>
<body>
<p>本例使用 HTML DOM 将 "onplay" 事件分配给 video 元素。</p>
<p>Press play.</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").onplay = function() {myFunction()};
function myFunction() {
  alert("The video has started to play.");
}
</script>
</body>
</html>