English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML-Referenzhandbuch

HTML-Tag-Übersicht

HTML Audio/Video DOM loop-Eigenschaft

Die loop-Eigenschaft ist eine Abbildung der HTML-Tag-Eigenschaft loop, die angibt, ob ein Medienelement nach Beendigung der Wiedergabe neu gestartet wird.

 HTML Audio/Video DOM Reference Manual

Online-Beispiel

Setzen Sie das Video auf Wiedergabe in Endlosschleife:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/Video loop Eigenschaft verwenden-Grund教程(oldtoolbag.com)</<title>
</<head>
<body>
<button onclick="enableLoop()" type="button">Wiedergabe wiederholt</button>
<button onclick="disableLoop()" type="button">Schalten Sie die Wiedergabe wiederholt aus</button>
<button onclick="checkLoop()" type="button">Überprüfen Sie den Wiedergabestatus</button>
<br> 
<video id="video1" controls="controls">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  Ihr Browser unterstützt keine HTML5 Video. Ihr Browser unterstützt keine HTML5 video  Tag.
</video>
<script>
myVid=document.getElementById("video1);
function enableLoop()
{ 
  myVid.loop=true;
  myVid.load();
} 
function disableLoop()
  { 
  myVid.loop=false;
  myVid.load();
  } 
function checkLoop()
  { 
  alert(myVid.loop);
  } 
</script>  
</body>
</html>
Test and see ‹/›

Definition and Usage

loop attribute sets or returns audio/Whether the video should restart playing after the playback is complete.

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the loop attribute.

Note:Internet Explorer 8 And earlier versions do not support this attribute.

Syntax

Set loop attribute:

audio|video.loop=true|false

Return loop attribute:

audio|video.loop

Attribute value

ValueDescription
trueIndicates audio/The video should be replayed at the end.
falseDefault. Indicates audio/The video should not be replayed at the end.

Technical Details

Return value:Boolean value, true|false
Default value:false
 HTML Audio/Video DOM Reference Manual