--- title: GlobalEventHandlers.onended slug: Web/API/GlobalEventHandlers/onended translation_of: Web/API/GlobalEventHandlers/onended ---
{{ ApiRef("HTML DOM") }}

The onended property of the {{domxref("GlobalEventHandlers")}} mixin is the {{event("Event_handlers", "event handler")}} for processing {{event("ended")}} events.

The ended event is fired when playback has stopped because the end of the media was reached.

语法

element.onended = handlerFunction;
var handlerFunction = element.onended;

handlerFunction 可以为 null 或者具体的事件响应函数。

规范

Specification Status Comment
{{SpecName('HTML WHATWG','#handler-onended','onended')}} {{Spec2('HTML WHATWG')}}  

 浏览器兼容性

{{Compat("api.GlobalEventHandlers.onended")}}

参考