<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
ul{
list-style: none;
}
.box{
width: 350px;
height: 300px;
background-color:pink ;
margin: 0 auto;
overflow: hidden;
}
.mt span{
display:inline-block;
width: 80px;
height: 30px;
background-color: deeppink;
line-height: 30px;
text-align: center;
cursor: pointer;
}
.mt span.current{
background-color: purple;
}
.mb li{
width: 100%;
height: 270px;
background: purple;
display: none;
}
.mb li.show{
display: block;
}
</style>
<script>
window.onload = function(){
var spans = document.getElementsByTagName("span");
var lis = document.getElementsByTagName("li");
for(var i=0;i<spans.length;i++){
spans[i].index = i;
spans[i].onmouseover = function(){
for(var j=0;j<spans.length;j++){
spans[j].className = ‘‘;
lis[j].className = ‘‘;
}
this.className = ‘current‘;
lis[this.index].className = "show";
}
}
}
</script>
</head>
<body>
<div class="box">
<div class="mt">
<span class="current">新闻</span>
<span>体育</span>
<span>娱乐</span>
<span>八卦</span>
</div>
<div class="mb">
<ul>
<li class="show">新闻模块</li>
<li>体育模块</li>
<li>娱乐模块</li>
<li>八卦模块</li>
</ul>
</div>
</div>
</body>
</html>
tab栏
Posted verayangnakiss
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tab栏相关的知识,希望对你有一定的参考价值。
以上是关于tab栏的主要内容,如果未能解决你的问题,请参考以下文章