当您按“开始”时,Video1 应启动,而当您按下“停止”按钮时,Video2 应启动并隐藏 Video1。我的问题是,带有Video1的块隐藏并且Video2启动,但是当您按START按钮时,Video1不会启动。如果您要删除启动Video2的脚本的一部分,则Video1将启动并隐藏工作。
function hideLayer(ObHide) {
document.getElementById(ObHide).style.visibility = "hidden";
}
function showLayer(ObShow) {
document.getElementById(ObShow).style.visibility = "visible";
}
// Master function, encapsulates all functions
function init() {
var video = document.getElementById("Video1");
if (video.canPlayType) {
document.getElementById("buttonbar1").style.display = "block";
document.getElementById("play").addEventListener("click", vidplay, false);
function vidplay(evt) {
if (video.src == "vid.mp4") { // on first run, src is empty, go get file
getVideo();
}
button = evt.target; // get the button id to swap the text based on the state
if (video.paused) { // play the file, and display pause symbol
video.play();
button.textContent = "START";
}
}
} // end of runtime
}
// end of master
// Master function, encapsulates all functions
function init() {
var video = document.getElementById("Video2");
if (video.canPlayType) {
document.getElementById("buttonbar").style.display = "block";
document.getElementById("stop").addEventListener("click", vidplay, false);
function vidplay(evt) {
if (video.src == "vid.mp4") { // on first run, src is empty, go get file
getVideo();
}
button = evt.target; // get the button id to swap the text based on the state
if (video.paused) { // play the file, and display pause symbol
video.play();
button.textContent = "STOP";
}
}
}
} // end of runtime
// end of master
* {
padding: 0;
margin: 0;
}
html {
height: 300px;
}
body {
height: 600px;
padding: 0;
margin: 0;
}
慕哥9229398
qq_花开花谢_0
相关分类