--- title: HTMLMediaElement.loop slug: Web/API/HTMLMediaElement/loop translation_of: Web/API/HTMLMediaElement/loop ---
HTMLMediaElement.loop
属性是 HTML 标签 {{htmlattrxref("loop", "video")}} 属性的映射,它决定了媒体元素播放结束时是否重新开始。原文:The HTMLMediaElement.loop
property reflects the {{htmlattrxref("loop", "video")}} HTML attribute, which controls whether the media element should start over when it reaches the end.
var loop = video.loop; audio.loop = true;
一个布尔值 {{domxref("Boolean")}}.
var obj = document.createElement('video'); obj.loop = true; // true
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', "the-video-element.html#htmlmediaelement", "HTMLMediaElement.loop")}} | {{Spec2('HTML WHATWG')}} | No change from {{SpecName('HTML5 W3C')}} |
{{SpecName('HTML5 W3C', "embedded-content-0.html#htmlmediaelement", "HTMLMediaElement.loop")}} | {{Spec2('HTML5 W3C')}} | Initial definition. |