<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>节点属性</title>
</head>
<body>
<ul>
<li>javascript</li>
<li>HTML/CSS</li>
<li>jQuery</li>
</ul>
<script type="text/javascript">
var lis = document.getElementsByTagName("li");
for(int i=0;i<lis.length;i++){
document.write(lis[i].nodeName + "<br>");
document.write(lis[i].nodeValue + "<br>");
document.write(lis[i].nodeType + "<br>");
}
</script>
</body>
</html>
for循环中,i的初始化用 var定义