<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>节点属性</title>
<style type="text/css">
.div_box{margin:50px auto;width: 600px;}
.div_box li{margin: 10px 0;}
</style>
</head>
<body>
<div class="div_box">
<p>我的课程</p>
<ul>
<li title="css3">css3</li>
<li title="html5">html5</li>
<li title="javascript">javascript</li>
<li title="JQuery">JQuery</li>
<li title="页面布局">页面布局</li>
<li title="">web前端技术</li>
</ul>
</div>
<script type="text/javascript">
var Lists=document.getElementsByTagName("div")[0].childNodes;
for (i = 0; i < Lists.length; i++) {
document.write("节点类型:"+ Lists[i].nodeName+Lists[i].nodeType+Lists[i].nodeValue+"<br/>");
};
</script>
</body>
</html>
document.getElementsByTagName("div") 获取的是所有的div,是一个数组,加了[0]表示这个数组的第一个元素,即类名为"div_box"的div
document.write("节点类型:"+ Lists[i].nodeName+Lists[i].nodeType+Lists[i].nodeValue+"<br/>"); //分号打错了