?
var f = document.getElementById("f");
var childs = f.childNodes;
for(var i = childs.length - 1; i >= 0; i--) {
alert(childs[i].nodeName);
f.removeChild(childs[i]);
}
?倒过来删,这样索引不会乱。
?
var f = document.getElementById("f");
var childs = f.childNodes;
for(var i = childs.length - 1; i >= 0; i--) {
alert(childs[i].nodeName);
f.removeChild(childs[i]);
}
?倒过来删,这样索引不会乱。