<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="box">你好啊</div>
</body>
<script>
var ele =document.getElementById("box");
var att =ele.getAttributeNode("id");
var text = ele.firstChild;
console.log(ele);
console.log(att);
console.log(text);
</script>
</html>
如果将 var att =ele.getAttribute("id");
那么说明属性节点是在元素里面的对象.