<script>
function del(){
var tBody = document.getElementById("newbody");
var tr_child = tBody.childNodes;
alert(tr_child);
alert("start len = "+tr_child.length)
var len = tr_child.length;
for(var j=0;j<len;j++){
tBody.removeChild(tr_child[0]); //
//每次删除元素后,后来的元素的索引就变成了又重0开始 ,
//这个问题一步一步alert出来的,汗一个....
}
alert("end len = "+tr_child.length);
}
</script>
<body οnlοad="del()">
<table>
<tbody id="newbody">
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
</tbody>
</table>
</body>