我写了以下法典:
function byId(id) {
return document.getElementById(id);
}
function addElm(root,elm) {
document.createElement(elm);
if(!root) {
root = document;
}
root.appendChild(elm);
return elm;
}
document.addEventListener( DOMContentLoaded ,function() {
var elm = byId( myExistingElmId );
addElm(elm, span );
},false);
The element having id "myExistingElmId" is there in my document. The line
root.appendChild(elm);
• 给我以青春期的以下错误:
Uncaught error: NOT_FOUND_ERR: DOM Exception 8
为什么会发生这种情况?