var tbody = document.getElementById('table').lastChild;
这个是因为<table>标签在其下有thead,tbody,tfoot.三个子节点,在不设置的时候,tbody是会默认的。所以说document.getElementById('table').lastChild 其实是指tbody这个节点
加上.lastChild之后表示你的document.getElementById('table')这个节点中的最后一个子节点了
你代码呢