最后一个综合题目,我为什么这道题错了啊,我看了好多遍
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>实践题 - 选项卡</title>
<style type="text/css">
/* CSS样式制作 */
#content{
height:220px;
line-height: 25px;
border:1px solid #336699;
border-top:none;
padding:5px;
float:left;
}
#show span{
width:80px;
height:30px;
text-align: center;
line-height: 30px;
margin-left:15px;
border:1px solid red;
float:left;
}
.hide{
display: none;
}
</style>
<script type="text/javascript">
// JS实现选项卡切换
window.onload = function() {
var all=document.getElementById("alldiv");
var con=all.getElementsByName("span");
var botm1=all.getElementById("content");
var botm=botm1.getElementsByName("div");
for(var i=0; i<con.length; i++){
con[i].index = i;
con[i].onclick=function(){
/*这里是相对于未被点击的部分的样式*/
for(var j=0; j<con.length; j++){
con[j].className = "";
botm[j].className = "hide";
}
this.className = "show";
botm[this.index].className ="";
}
}
}
</script>
</head>
<body>
<!-- HTML页面布局 -->
<div id="alldiv">
<div id="show">
<span>房产</span>
<span>家居</span>
<span>二手房</span>
</div><!--show结束-->
<div id="content">
<div>
<p>275万购昌平邻铁三居 总价20万买一居</p>
<p> 200万内购五环三居 140万安家东三环</p>
<p> 北京首现零首付楼盘 53万购东5环50平</p>
<p> 京楼盘直降5000 中信府 公园楼王现房</p>
</div>
<div>
<p>40平出租屋大改造 美少女的混搭小窝</p>
<p>经典清新简欧爱家 90平老房焕发新生</p>
<p>新中式的酷色温情 66平撞色活泼家居</p>
<p>瓷砖就像选好老婆 卫生间烟道的设计</p>
</div>
<div>
<p>通州豪华3居260万 二环稀缺2居250w甩</p>
<p>西3环通透2居290万 130万2居限量抢购</p>
<p>黄城根小学学区仅260万 121平70万抛!</p>
<p>独家别墅280万 苏州桥2居优惠价248万</p>
</div>
</div>
</div>
</body>
</html>