1
아래 스크립트를 사용하여 노드를 dhtmlx 트리에 추가했습니다. DHTMLX 트리에서 getSelectedItemId()를 사용하여 ID를 가져 오려고했습니다.이 오류가 발생했습니다.Uncaught TypeError : 'Node'에서 'appendChild'를 실행하지 못했습니다. 매개 변수 1의 유형이 'Node'가 아닙니다.
<script>
var xmlDoc
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
xmlDoc = this;
}
};
xhttp.open("GET", "data/treeStruct.xml", true);
xhttp.send();
var myTree;
function append(id){
var x;
var ed1=document.getElementById('ed1').value;
//alert(id);
xmlDoc = xmlDoc.responseXML;
var newEle = xmlDoc.createElement(id);
newEle.appendChild(ed1);
document.getElementsByTagName("tree")[0].appendChild(newEle);
}
</script>