<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<script>
var g=document.getElementById("g");
var list=g.getElementsByTagName("*");
alert(list.length);
</script>
</head>
<body>
<ul id="g">
<li>1</li>
<li>1</li>
<li>1</li>
<li>1</li>
<li>1</li>
<li>1</li>
</ul>
</body>
</html>为什么会跳出Uncaught TypeError: Cannot read property 'getElementsByTagName' of null
我看了好几遍 好像没有错 麻烦大家帮我看一下 非常感谢
Annguowenhua
相关分类