<!DOCTYPE html>
<html>
<body>

<h3>演示如何访问 VIDEO 元素</h3>

<video id="myVideo" width="320" height="240" controls>
  <source src="/i/movie.mp4" type="video/mp4">
  <source src="/i/movie.ogg" type="video/ogg">
  Your browser does not support the video tag.
</video>

<p>请点击按钮来获得以秒计的视频时长。</p>

<p id="demo"></p>

<button onclick="myFunction()">试一下</button>

<script>
function myFunction()
{
var x = document.getElementById("myVideo").duration;
document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

 

相关文章:

  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2022-02-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
猜你喜欢
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
相关资源
相似解决方案