qq_明_23
2017-03-21 02:05
<!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 aa=document.getElementsByTagName("li");
for(var a=0;a<aa.lenght;a++){
document.write(aa[a].nodeName);
document.write(aa[a].nodeValue);
document.write(aa[a].nodeType);
}
</script>
</body>
</html>
aa.length而不是lenght
for(var a=0;a<aa.lenght;a++){改为aa.length
JavaScript进阶篇
468194 学习 · 21891 问题
相似问题