当媒体开始以HTML格式播放时执行脚本吗?
使用onplaying 属性使用户知道音频/视频已开始播放。
示例
您可以尝试运行以下代码,以学习在媒体开始播放时如何执行脚本-
<!DOCTYPE html>
<html>
<body>
<video id = "myid" width = "350" height = "200" controls onplaying = "display()">
<source src = "/html5/foo.ogg" type = "video/ogg" />
<source src = "/html5/foo.mp4" type = "video/mp4" />
Your browser does not support the video element.
</video>
<script>
function display() {
alert("视频开始播放!");
}
</script>
</body>
</html>热门推荐
10 分别发的祝福语简短
11 大外甥高考祝福语简短
12 小学毕业校长简短祝福语
13 搞工程发财祝福语简短
14 冬季祝福语男生文案简短
15 同事生子问候祝福语简短
16 退休文案寄语简短祝福语
17 送给自己的祝福语简短
18 简短祝福语毛笔字