为什么alert出来的值是0,这样没法继续写了
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>实践题 - 选项卡</title>
<style type="text/css">
#ul li{float:left;border-right:1px solid gray;border-left:1px solid gray;margin-right:10px;padding:5px 10px;
width:50px;text-align:center;vertical-align:middle;}
#ul{overflow:auto;margin-left:2px;z-index:999;position:relative;margin-top:1px;}
*{list-style:none;margin:0;padding:0;}
.li_second,.li_third{border-top:1px solid gray;
border-bottom:1px solid red;}
.li_first{border-bottom:1px solid white;
border-top:1px solid red;}
.content{border-left:1px solid blue;
border-right:1px solid blue;
border-bottom:1px solid blue;
border-top:1px solid red;width:280px;
position:absolute;top:31px;
}
</style>
<script type="text/javascript">
var x=document.getElementsByTagName("li");
alert(x.length);
</script>
</head>
<body>
<div id="div">
<ul id="ul">
<li class="li_first">房产</li>
<li class="li_second">家居</li>
<li class="li_third">二手房</li>
</ul>
</div>
<div class="content">275万购昌平邻铁三居 总价20万买一居</br>
200万内购五环三居 140万安家东三环</br>
北京首现零首付楼盘 53万购东5环50平</br>
京楼盘直降5000 中信府 公园楼王现房
</div>
</body>
</html>