gpt4 book ai didi

javascript - 接手一个元素,flowplayer加载HUD但不加载视频

转载 作者:行者123 更新时间:2023-11-28 12:33:44 26 4
gpt4 key购买 nike

我在一个网站上工作,该网站使用 flowplayer 来绕过播放视频,但它不工作。

控制台告诉我,我脑海中以 video.addEventListener 开头的一行特别有问题:

说:无法调用方法 addEventListener。

如果您不知道,我是编码的新手。网站:sems-usa.com/Duramatic/index.html如果需要,我可以发布更多上下文。非常感谢任何帮助。

 <!--
function MM_preloadImages() { //v3.0

var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}
//-->
var video = document.getElementById('video');
video.addEventListener('click',function(){
Uncaught TypeError: Cannot call method 'addEventListener' of null
video.play();
},false);
</script>

更多背景

// a- tags with class "myPlayer" are transformed into video players

flowplayer("a.myPlayer", "video/flowplayer-3.2.6.swf", {



// this is the player configuration. You'll learn on upcoming demos.

plugins: {

controls: {

volume: false

}

}

});

最佳答案

Uncaught TypeError: Cannot call method 'addEventListener' of null 说你的 var video = document.getElementById('video'); 实际上没有找到页面上带有视频 ID 的元素(视频指定为 null)

尝试换行

<a class="myPlayer" href="video/Duramatic0713.flv"> 

<a id="video" class="myPlayer" href="video/Duramatic0713.flv">

关于javascript - 接手一个元素,flowplayer加载HUD但不加载视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18090890/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com