<!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?我看了好幾遍 好像沒有錯 麻煩大家?guī)臀铱匆幌?非常感謝
關于getElementsTagName的通配器的問題
Beckybei
2015-08-13 12:07:14