이 문서는 아직 자원 봉사자들이 한국어로 번역하지 않았습니다. 참여해서 번역을 마치도록 도와 주세요!
English (US)의 문서도 읽어보세요.

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>

Specification

Specification Status Comment
HTML Living Standard
The definition of 'onplay' in that specification.
Living Standard

 

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
onplayChrome Full support YesEdge ? Firefox Full support 3.5IE ? Opera ? Safari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android Full support 4Opera Android ? Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also

문서 태그 및 공헌자

이 페이지의 공헌자: mdnwebdocs-bot, mfluehr, fscholz, wbamberg, Guillaume-Heras, rolfedh
최종 변경자: mdnwebdocs-bot,