使用此代码DOM错误使用JavaScript附加
var html='<div class="somediv"></div>';
var target=document.getElementById('contentArea');
target.appendChild(html);
我越来越
Uncaught Error: NOT_FOUND_ERR: DOM Exception 8
Uncaught TypeError: Cannot call method 'appendChild' of null
什么建议吗?
这听起来并不令人兴奋。试试:'null.appendChild(“foo”)',注意错误信息,并向后工作。 – 2012-03-31 02:32:44