关于删除节点的问题
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<div id="content">
<h1>html</h1>
<h1>php</h1>
<h1>javascript</h1>
<h1>jquery</h1>
<h1>java</h1>
</div>
<script type="text/javascript">
function clearAll() {
var content=document.getElementById("content");
for(var i=content.childNodes.length-1;i>=0;i--) {
var childNode = content.childNodes[i];
content.removeChild(childNode);
}
}
function clearOne() {
content.removeChild(content.childNodes[content.childNodes.length-1]);
}
</script>
<button onclick="clearAll()">清除全部全部全部节点内容</button>
<button onclick="clearOne()">qingchu清楚一个</button>
</body>
</html>
求大神解答,为什么第二个button要点两次才能删除一个节点?谢谢!