<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<script type="text/javascript">
function clearText() {
var con=document.getElementById("content");
var x = con.removeChilds(con.childNodes[2]);
document.write("删除的内容是"+x.innerHTML);
}
</script>
<div id="content">
<h1>html</h1>
<h1>php</h1>
<h1>javascript</h1>
<h1>jquery</h1>
<h1>java</h1>
</div>
<input type="button" onClick="clearText()" value="清除文本">
</body>
</html>
.removeChild() 没有.removeChilds()
改为con.childNodes[1]可以删除,但是偶数位置上的节点删不掉