Sixteen_mm
2017-06-20 12:03
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<div>
javascript
<p>javascript</p>
<div>jQuery</div>
<h5>PHP</h5>
</div>
<script type="text/javascript">
var a=document.getElementsByName("div")[0].childNodes;
for(var i=0;i<a.length;i++)
{
document.write(a[i].nodeType);
}
</script>
</body>
</html>
document.getElementsByName 改成document.getElementsByTagName
JavaScript进阶篇
468061 学习 · 21891 问题
相似问题