nodeName 节点名称
nodeType 节点类型
nodeValue 节点的值
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>test</title>
</head>
<body>
<input type="text" id="nameId" value="zhangsan" />
<span id="spanId">我是span区域</span>
</body>
<script type="text/javascript">
/*
元素 属性 文本
nodeName 大写的标签名 属性名称 #text
nodeType 固定的1 固定的2 固定的3
nodeValue null 属性的值 内容
parentNode 获取父节点
childNodes 所有子节点
firstChild 第一个子节点
lastChild 最后一个子节点
*/
var input = document.getElementById("nameId");
alert(input.nodeName); //INPUT
alert(input.nodeType); //1
alert(input.nodeValue); //null
var attr = input.getAttributeNode("type");
alert(attr.nodeName); //type
alert(attr.nodeType); //2
alert(attr.nodeValue); //text
var span = document.getElementById("spanId");
var text = span.firstChild;
alert(text.nodeName); //#text
alert(text.nodeType); //3
alert(text.nodeValue); //我是span区域
</script>
</html>