<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>W3Cschool教程(w3cschool.cn)</title>
</head>
<body>
<video id="myVideo" width="320" height="240" controls>
<source src="/statics/demosource/movie.mp4" type="video/mp4">
<source src="/statics/demosource/movie.ogg" type="video/ogg">
您的浏览器不支持 video 标签。
</video>
<p>点击按钮返回视频 width 属性值。</p>
<p id="demo"></p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction(){
var x = document.getElementById("myVideo").width;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>