【发布时间】:2014-09-01 09:06:49
【问题描述】:
每当我尝试按下按钮时,它们仅适用于其中 1 个视频,而不是用于预期视频的每组。任何帮助将不胜感激。顺便说一句,我正在使用谷歌浏览器。谢谢:)
<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">Big</button>
<button onclick="makeSmall()">Small</button>
<button onclick="makeNormal()">Normal</button>
<br>
<video id="myVideo1" width="420">
<source src="r8_ext.mp4" type="video/mp4">
</video>
</div>
<script>
var myVideo = document.getElementById("myVideo1");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function makeBig() {
myVideo.width = 560;
}
function makeSmall() {
myVideo.width = 320;
}
function makeNormal() {
myVideo.width = 420;
}
</script>
<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">Big</button>
<button onclick="makeSmall()">Small</button>
<button onclick="makeNormal()">Normal</button>
<br>
<video id="myVideo2" width="420">
<source src="r8_int.mp4" type="video/mp4">
</video>
</div>
<script>
var myVideo = document.getElementById("myVideo2");
function playPause() {
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function makeBig() {
myVideo.width = 560;
}
function makeSmall() {
myVideo.width = 320;
}
function makeNormal() {
myVideo.width = 420;
}
</script>
谢谢:)
【问题讨论】:
标签: html google-chrome video