基于Web的最基本的Tab滑动门(同一页面可多次使用)

<style type="text/css">
/*选项卡1*/
#Tab1{
width:460px;
margin:0px;
padding:0px;
margin:0 auto;}
/*菜单class*/
.Menubox {
width:100%;
height:28px;
line-height:28px;
}
.Menubox ul{
margin:0px;
padding:0px;
}
.Menubox li{
float:left;
display:block;
cursor:pointer;
width:114px;
text-align:center;
color:#949694;
font-weight:bold;
}
.Menubox li.hover{
padding:0px;
background:#fff;
width:116px;
border-left:1px solid #A8C29F;
border-top:1px solid #A8C29F;
border-right:1px solid #A8C29F;
color:#739242;
font-weight:bold;
height:27px;
line-height:27px;
}
.Contentbox{
clear:both;
margin-top:0px;
border:1px solid #A8C29F;
border-top:none;
height:181px;
text-align:center;
padding-top:8px;
}
--></style>
<script type="text/javascript">
<!--
/*第一种形式 第二种形式 更换显示样式*/
function setTab(name, cursel, n) {
for (i = 1; i <= n; i++) {
var menu = document.getElementById(name + i);
var con = document.getElementById("con_" + name + "_" + i);
menu.className = i == cursel ? "hover" : "";
con.style.display = i == cursel ? "block" : "none";
}
}
//-->
</script>

<div id="Tab1">
<div class="Menubox">
<ul>
<li class="hover" id="one1" οnclick="setTab('one',1,4)">新闻1 </li>
<li id="one2" οnclick="setTab('one',2,4)">新闻2 </li>
<li id="one3" οnclick="setTab('one',3,4)">新闻3 </li>
<li id="one4" οnclick="setTab('one',4,4)">新闻4 </li>
</ul>
</div>
<div class="Contentbox">
<div class="hover" id="con_one_1">
新闻列表1</div>
<div id="con_one_2" style="display: none">
新闻列表2</div>
<div id="con_one_3" style="display: none">
新闻列表3</div>
<div id="con_one_4" style="display: none">
新闻列表4</div>
</div>
</div>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值