实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html> 
2
<html> 
3
<body> 
4
5
<button onclick="enableControls()" type="button">Enable controls</button>
6
<button onclick="disableControls()" type="button">Disable controls</button>
7
<button onclick="checkControls()" type="button">Check controls status</button>
8
<br> 
9
<video id="video1">
10
  <source src="/upload/love/movie.mp4" type="video/mp4">
11
  <source src="mov_bbb.ogg" type="video/ogg">
12
  Your browser does not support HTML5 video.
13
</video>
14
15
<script>
16
myVid=document.getElementById("video1");
17
function enableControls()
18
  { 
19
  myVid.controls=true;
20
  myVid.load();
21
  } 
22
function disableControls()
23
  { 
24
  myVid.controls=false;
25
  myVid.load();
26
  } 
27
function checkControls()
28
  { 
29
  alert(myVid.controls);
30
  } 
31
</script> 
32
33
<p>Video courtesy of <a href="https://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
34
35
</body> 
36
</html>
37
38