比較簡單易懂
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script type="text/javascript">
window.onload=function(){
li=document.getElementsByClassName("l");
box=document.getElementsByClassName("n");
bo=document.getElementById("select1");
}
i=1
l=0
function one(){
i++
l++
li[0].style.zIndex=i
box[0].style.zIndex=l
}
function two(){
i++
l++
li[1].style.zIndex=i
box[1].style.zIndex=l
}??
function three(){
i++
l++
li[2].style.zIndex=i
box[2].style.zIndex=l
}??
</script>
<ul>
<a href="javaScrip:;" onclick=one()><li id="select1" class="l">房產</li></a>
<a href="javaScrip:;" onclick=two()><li id="select2" class="l">家居</li></a>
<a href="javaScrip:;" onclick=three()><li id="select3" class="l">二手房</li></a>
</ul>
<div id="house" class="n">
275萬購昌平鄰鐵三居 總價20萬買一居<br>
200萬內購五環三居 140萬安家東三環<br>
北京首現零首付樓盤 53萬購東5環50平<br>
京樓盤直降5000 中信府 公園樓王現房<br>
</div>
<div id="home" class="n">
40平出租屋大改造 美少女的混搭小窩<br>
經典清新簡歐愛家 90平老房煥發新生<br>
新中式的酷色溫情 66平撞色活潑家居<br>
? ? 瓷磚就像選好老婆 衛生間煙道的設計<br>
</div>
<div id="house2" class="n">
通州豪華3居260萬 二環稀缺2居250w甩<br>
西3環通透2居290萬 130萬2居限量搶購<br>
黃城根小學學區僅260萬 121平70萬拋!<br>
獨家別墅280萬 蘇州橋2居優惠價248萬<br>
</div>
<style type="text/css">
*{
margin: 0;
padding: 0;
list-style: none;
}
a{
color: black;
}
.n{
width: 300px;
height: 130px;
border: 2px solid;
border-color: #b65b00 #00b3b3 #00b3b3 #00b3b3;
position: absolute;
top: 100px;
left: 50px;
background-color: white;
padding: 5px;
line-height: 30px;
}
.l{
float: left;
position: absolute;
top: 57px;
left: 55px;
border: 2px solid;
border-color: #b65b00 #00b3b3 #fff #00b3b3;
padding: 10px;
}
#select1{
z-index: 1;
}
#select2{
margin-left:70px ;
}
#select3{
margin-left: 140px;
}
</style>
</body>
</html>