GlobalEventHandlers.onplay - Web APIs 编辑
The onplay
property of the GlobalEventHandlers
mixin is the EventHandler
for processing play
events.
Syntax
element.onplay = handlerFunction; var handlerFunction = element.onplay;
handlerFunction
should be either null
or a JavaScript function specifying the handler for the event.
Example
<p>This example demonstrates how to assign an "onplay" event to a video element.</p>
<video controls onplay="alertPlay()">
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
<p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
<script>
function alertPlay() {
alert("The video has started to play.");
}
</script>
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'onplay' in that specification. | Living Standard |
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论