<script>
document.getElementsByClassName("student")[0].onclick = addStudent("new element",text here ",document.getElementsByClassName("Class")[0]);
function addStudent(name,text,hendle)
{
var div=document.createElement("div");
var dt=document.createElement("dt");
var strong=document.createElement("strong").innerHTML = name;
var dd=document.createElement("dd").innerHTML = text;
dt.appendChild(strong);
div.appendChild(dt);
div.appendChild(dd);
div.setAttribute("class","student");
hendle.appendChild(div);
}
</script>`
---> 当我运行脚本时,萤火虫出现错误:
NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 0 [nsIDOMHTMLElement.appendChild]
[Break On This Error]
dt.appendChild(强);
---> 而且这个脚本也不起作用..脚本位置在页面的末尾。如何解决?(我才开始学习 javascript)