Dom 获得;未捕获的HierarchyRequestError:未能执行';追加儿童';在';节点';:新的子元素包含父元素;错误
我不明白为什么我会犯这个错误。javascript的新特性。功能正常,但控制台给了我这个“未捕获的HierarchyRequestError”。任何提示都会有帮助 htmlDom 获得;未捕获的HierarchyRequestError:未能执行';追加儿童';在';节点';:新的子元素包含父元素;错误,dom,appendchild,Dom,Appendchild,我不明白为什么我会犯这个错误。javascript的新特性。功能正常,但控制台给了我这个“未捕获的HierarchyRequestError”。任何提示都会有帮助 html 青金石、纸莎草、手术刀 (石头、布、剪刀) 请做出选择 青金石 纸莎草 手术刀 js (字符串变量只是一个“youwin!”或“youlose!”)。函数在单击按钮后调用 //displays the results on the webpage function displayResults(string) { c
青金石、纸莎草、手术刀
(石头、布、剪刀)
请做出选择
青金石
纸莎草
手术刀
js
(字符串变量只是一个“youwin!”或“youlose!”)。函数在单击按钮后调用
//displays the results on the webpage
function displayResults(string) {
const displayElement = document.querySelector('h3');
displayElement.innerHTML = string + "<br> The Computer chose " + computer.currentChoice + " and You chose " + player.currentChoice;
const newParagraph = document.querySelector('#results');
newParagraph.appendChild(displayElement);
}
//在网页上显示结果
函数显示结果(字符串){
const displayement=document.querySelector('h3');
displayElement.innerHTML=string+“
计算机选择了“+Computer.currentChoice+”,而您选择了“+player.currentChoice;
const newparagration=document.querySelector(“#results”);
new段落.appendChild(displayElement);
}
//displays the results on the webpage
function displayResults(string) {
const displayElement = document.querySelector('h3');
displayElement.innerHTML = string + "<br> The Computer chose " + computer.currentChoice + " and You chose " + player.currentChoice;
const newParagraph = document.querySelector('#results');
newParagraph.appendChild(displayElement);
}