【发布时间】:2014-06-17 13:46:17
【问题描述】:
我遇到了 Javascript 问题。我收到此错误消息:
Uncaught NotFoundError: Failed to execute 'insertBefore' on 'Node': 要插入新节点的节点不是该节点的子节点。
Javascript:
var vidCounter = 0;
vidCounter++;
var originalDiv;
var newVideo = document.createElement("video");
newVideo.setAttribute("name", vidCounter);
newVideo.setAttribute("autoplay", "true");
originalDiv = document.getElementById("othersarea");
document.body.insertBefore(newVideo, originalDiv);
它试图在一个名为othersarea的div下面添加一个<video>标签。
<div id="remoteVideos">
<div class="title">
<h2>Others</h2>
</div>
<div id="othersarea">
</div>
</div>
我该如何解决这个问题?
我还想在我的新视频标签上运行attachMediaStream([VIDEO TAG HERE HOW?], event.stream);。
【问题讨论】:
标签: javascript jquery