getElementById和getElementsByTagName的使用
<div id="content">
<h3>html</h3>
<h3>php</h3>
<h3>javascript</h3>
<h3>jquery</h3>
<h3>java</h3>
</div>
<script type="text/javascript">
function clearText() {
var content=document.getElementById("content");
for(var i=content.childNodes.length-1;i>=0;i--){
var childNode = content.childNodes[i];
content.removeChild(childNode);
}
}
上面获取<div>这个父节点用getElementById("content")能不能换成getElementsByTagName("div")