这个button标签的节点名是什么?
为什么我无法得到这个标签的节点名?
document.write(document.getElementById("button").nodeName);
为什么我无法得到这个标签的节点名?
document.write(document.getElementById("button").nodeName);
2016-10-28
<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 clearText() {
var content=document.getElementById("content");
while(content.firstChild!=null){
content.removeChild(content.firstChild);
}
alert(" 已经全部清除 ");
}
document.write(document.getElementById("button").nodeName);
document.write(555);
</script>
<button id="button" onclick="clearText()">清除节点内容</button>
</body>
</html>举报