x
 
<!DOCTYPE html>
<html>
<body>
<h1>Element 对象</h1>
<h2>nodeType 属性</h2>
<p id="myP">点击按钮可获取该元素的节点类型。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myP").nodeType;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>