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

HTML-Referenzhandbuch

HTML-Tag-Liste

HTML Audio/Video DOM controls Attribut

Das Attribut controls ist für die Steuerung der HTML-Attribut controlsHTML verantwortlich, es kontrolliert, ob die Steuerelemente der wiedergegebenen Medien (Video oder Audio) angezeigt werden sollen.

 HTML Audio/Video DOM Reference Manual

Online-Beispiel

Aktivieren Sie die Video-Steuerelemente:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Audio/Verwendung der video controls-Attribut-Grundlagen-Tutorial(oldtoolbag.com)</<title>
</<head>
<body>
<button onclick="enableControls()" type="button">Steuerelemente aktivieren</button>
<button onclick="disableControls()" type="button">Steuerelemente deaktivieren</button>
<button onclick="checkControls()" type="button">Prüfen Sie den Zustand der Steuerelemente</button>
<br> 
<video id="video1">
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/>
  Ihr Browser unterstützt keine    HTML5 video    Etikett.
</video>
<script>
myVid = document.getElementById("video",1");
function enableControls()
{ 
  myVid.controls = true;
  myVid.load();
} 
function enableControls()
{ 
  myVid.controls = false;
  myVid.load();
} 
function disableControls()
{ 
  alert(myVid.controls);
} 
</script> 
</body>
</html>
Test to see ‹/›

Definition and Usage

The controls control property sets or returns whether the browser should display standard audio/Video controls.

Standard audio/The video controls include:

  • Play

  • Pause

  • Progress Bar

  • Volume

  • Fullscreen Toggle (for video)

  • Subtitles (when available)

  • Track (when available)

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the controls attribute.

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

Syntax

Set controls attribute:

audio|video.controls=true|false

Return controls attribute:

audio|video.controls

Attribute value

ValueDescription
trueIndicates that the control should be displayed.
falseDefault. Indicates that the control should not be displayed.

Technical Details

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