thead = new Array();
alert(thead.length);
thead = document.getElementsByTagName("th");
alert(thead.length);
thead.pop();
alert(thead.length);
document.getElementsByTagName("th")
返回的是一个元素数组,因此 thead
变量应该是一个数组。但如果是这样,为什么会提示错误 "thead.pop() 不是一个函数"?
var last = thead[thead.length - 1]; last.parentNode.removeChild(last);
元素将从DOM中删除,以及thead
列表。 - user1106925