removeChild问题
<div id="content">
<h1>html</h1>
<h2>php</h2>
<h3>javascript</h3>
<h4>jquery</h4>
<h5>java</h5>
</div>
<script type="text/javascript">
function clearText(){
var content=document.getElementById("content");
var cnode = content.childNodes;
for(var i = 0; i < cnode.length; i++){
/*document.write( cnode[i].nodeName + "a" + "<br />");
document.write( cnode[i].nodeType + "b" + "<br />");
document.write( cnode[i].nodeValue + "c" + "<br />");*/
content.removeChild(cnode[i]);
}
}
</script>
<button onclick="clearText()">清除节点内容</button>
为什么要点击两次按钮才能删除#content中的几个元素?是浏览器节点bug问题吗