未捕获类型错误:无法读取属性';追加儿童';空javascript的定义
我一直在尝试使用视频标记从本地文件夹播放视频。设置为元素作为源的视频文件的路径是正确的,我可以使用“localhost/filepath…”在浏览器中播放它,但子文件仍表示其为空未捕获类型错误:无法读取属性';追加儿童';空javascript的定义,javascript,html,asp.net,Javascript,Html,Asp.net,我一直在尝试使用视频标记从本地文件夹播放视频。设置为元素作为源的视频文件的路径是正确的,我可以使用“localhost/filepath…”在浏览器中播放它,但子文件仍表示其为空 function PlayWordFile(fileNam) { debugger if (fileNam=="") { alert('No file attached.');
function PlayWordFile(fileNam)
{
debugger
if (fileNam=="")
{
alert('No file attached.');
return;
}
var extn = fileNam.split('.').pop();
if (extn == "mp4") {
var y=fileNam;
var video=document.getElementById('VideoPlayer');
var source=document.createElement('source');
source.setAttribute('src',"/x/"+y);
video.appendChild(source);
alert(source)
video.play();
}
}
Html代码:
<div id="PanelMainPlayer" runat="server">
<video id="videoPlayer" width="250" height="200" controls autoplay></video>
</div>
有人能在这里发现我做错了什么吗?很感谢你的帮助。你的HTML中有
videoPlayer
,JS中有videoPlayer
。你真的应该投票结束这些,而不是回答。打字错误是另一个原因