如何在javascript html中添加父/子节点
您好,在下面的代码中,我有一个用于建筑的树状视图结构。树状视图中包含一个建筑和不同的楼层。 现在在那栋楼里我有4层楼。假设我想在这幢楼里再加一层楼。那么怎么做呢 然后,如何为下面的代码将子节点添加到特定的父节点。单击“添加”按钮后,我可以将其添加到父节点或子节点下的位置 错误:如何在javascript html中添加父/子节点,javascript,html,Javascript,Html,您好,在下面的代码中,我有一个用于建筑的树状视图结构。树状视图中包含一个建筑和不同的楼层。 现在在那栋楼里我有4层楼。假设我想在这幢楼里再加一层楼。那么怎么做呢 然后,如何为下面的代码将子节点添加到特定的父节点。单击“添加”按钮后,我可以将其添加到父节点或子节点下的位置 错误: morris.js:86 Uncaught Error: Graph container element not found at Area.Grid [as constructor] (morris.js:86
morris.js:86 Uncaught Error: Graph container element not found
at Area.Grid [as constructor] (morris.js:86)
at Area.Line [as constructor] (morris.js:824)
at new Area (morris.js:1451)
at Object.Area (morris.js:1444)
at dashboard-ecommerce.js:202
chartist.min.js:8 Uncaught TypeError: Cannot read property 'querySelectorAll' of null
at Object.c.createSvg (chartist.min.js:8)
at f.e [as createChart] (chartist.min.js:9)
at f.h (chartist.min.js:8)
chartist.min.js:8 Uncaught TypeError: Cannot read property 'querySelectorAll' of null
at Object.c.createSvg (chartist.min.js:8)
at f.d [as createChart] (chartist.min.js:8)
at f.h (chartist.min.js:8)
chartist.min.js:8 Uncaught TypeError: Cannot read property 'querySelectorAll' of null
at Object.c.createSvg (chartist.min.js:8)
at f.d [as createChart] (chartist.min.js:8)
at f.h (chartist.min.js:8)
index.html:222 Uncaught ReferenceError: wijmo is not defined
at onload (index.html:222)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
建筑:
var node = document.createElement("div"); // Create a <div> node
var textnode = document.createTextNode("Extra Floor"); // Create a text node
node.appendChild(textnode); // Append the text to <div>
document.getElementById("building").appendChild(node); // Append <div> to the building with id="building"