作业代码.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
span{
cursor:pointer;
}
#c{
border: 1px solid #ccc;
border-top: 2px solid #ad5d34;
width: 350px;
height: 150px;
}
li{
line-height:28px;
}
.c{
border: 1px solid #ccc;
display:inline-block;
width: 70px;
height: 30px;
border-bottom: 2px solid #fff;
border-top: 2px solid #ad5d34;
margin-left:5px;
text-align: center;
line-height: 2em;
margin-bottom: -2px;
}
.unc{
border: 1px solid #ccc;
display:inline-block;
width: 70px;
height: 30px;
border-bottom: 2px solid #ad5d34;
margin-left:5px;
text-align: center;
line-height: 2em;
margin-bottom: -2px;
}
</style>
</head>
<body>
<div id="a" >
<span id="b1" class="c" onclick="f1(1)">房产</span>
<span id="b2" class="c" onclick="f1(2)">家居</span>
<span id="b3" class="c" onclick="f1(3)">二手房</span>
</div>
<div id="c">
<ol id="d1">
<li>275万购昌平邻铁三居 总价20万买一居</li>
<li>200万内购五环三居 140万安家东三环</li>
<li>北京首现零首付楼盘 53万购东5环50平</li>
<li>京楼盘直降5000 中信府 公园楼王现房</li>
</ol>
<ol id="d2">
<li>40平出租屋大改造 美少女的混搭小窝</li>
<li>经典清新简欧爱家 90平老房焕发新生</li>
<li>新中式的酷色温情 66平撞色活泼家居</li>
<li>瓷砖就像选好老婆 卫生间烟道的设计</li>
</ol>
<ol id="d3">
<li>通州豪华3居260万 二环稀缺2居250w甩</li>
<li>西3环通透2居290万 130万2居限量抢购</li>
<li>黄城根小学学区仅260万 121平70万抛!</li>
<li>独家别墅280万 苏州桥2居优惠价241万</li>
</ol>
</div>
<script>
f1(1);
function f1(aaa){
var b1=document.getElementById("b1");
var b2=document.getElementById("b2");
var b3=document.getElementById("b3");
var d1=document.getElementById("d1");
var d2=document.getElementById("d2");
var d3=document.getElementById("d3");
switch(aaa){
case 1:
b1.className = "c";
b2.className = "unc";
b3.className = "unc";
d1.style.display="block";
d2.style.display="none";
d3.style.display="none";
break;
case 2:
b1.className = "unc";
b2.className = "c";
b3.className = "unc";
d1.style.display="none";
d2.style.display="block";
d3.style.display="none";
break;
case 3:
b1.className = "unc";
b2.className = "unc";
b3.className = "c";
d1.style.display="none";
d2.style.display="none";
d3.style.display="block";
break;
}
}
</script>
</body>
</html>