<script>
var a = window.screen.width;
var b = window.screen.availHeight;
</script>
</head>
<body>
<video src="abc.mp4" width=a height=b controls preload></video>
</body>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
</head>
<body>
<video id="video" src="abc.mp4" controls preload></video>
<script>
var a = window.screen.width;
var b = window.screen.availHeight;
var obj = document.getElementById("video");
obj.style.width=a+"px";
obj.style.height=b+"px";
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
</head>
<body>
<video id="video" src="abc.mp4" controls preload></video>
<script>
var a = window.screen.width;
var b = window.screen.availHeight;
var obj = document.getElementById("video");
obj.style.width=a+"px";
obj.style.height=b+"px";
</script>
</body>
</html>
通过js代码可以实现对标签进行操作,比如设置和修改css属性等..。
但是为了方便,一般会给标签设置一个独一无二的id。
温馨提示:答案为网友推荐,仅供参考