找不到目标元素,大神们求解("Uncaught TypeError: Cannot read property 'appendChild' of null")
var initDiv = function(container, data, divs) {
for(var i = 0; i < data.length; i++) {
var div = [];
for(var j = 0; j < data[0].length; j++) {
var newNode = document.createElement('div');
newNode.className = 'none';
newNode.style.top = (i * 20) + 'px';
newNode.style.left = (j * 20) + 'px';
container.appendChild(newNode);
div.push(newNode);
}
divs.push(div);
}
}