我收到播放和暂停错误。两者都显示“Uncaught TypeError: Cannot read property 'play' of null at playVid”
我的代码如下,我不确定我做错了什么。
<button onclick="playVid()" type="button">Play Video</button>
<button onclick="pauseVid()" type="button">Pause Video</button><br>
<video id="myVideo" width="320" height="176">
<source src="<?php echo $video ?>" type="video/mp4">
</video>
var vid = document.getElementById("myVideo");
function playVid() {
vid.play();
}
function pauseVid() {
vid.pause();
}
function menuAnimate(x) {
$(".menu-wrap").toggleClass("open");
}
富国沪深