一个非常好用的DIV选项卡代码
资料来源:创思科技 人气:
<STYLE type=text/css>
.nTab{
float: left;
width: 100%;
margin: 0 auto;
border-bottom:1px #AACCEE solid;
background:#d5d5d5;
background-position:left;
background-repeat:repeat-y;
margin-bottom:2px;
}
.nTab .TabTitle{
clear: both;
height: 22px;
overflow: hidden;
}
.nTab .TabTitle ul{
border:0;
margin:0;
padding:0;
}
.nTab .TabTitle li{
float: left;
width: 70px;
cursor: pointer;
padding-top: 4px;
padding-right: 0px;
padding-left: 0px;
padding-bottom: 2px;
list-style-type: none;
font-size: 12px;
text-align: center;
margin: 0;
}
.nTab .TabTitle .active{background:#fff;border-left:1px #AACCEE solid;border-top:1px #AACCEE solid;border-right:1px #AACCEE solid;border-bottom:1px #fff solid;}
.nTab .TabTitle .normal{background:#EBF3FB;border:1px #AACCEE solid;}
.nTab .TabContent{
width:auto;background:#fff;
margin: 0px auto;
padding:10px 0 0 0;
border-right:1px #AACCEE solid;border-left:1px #AACCEE solid;
}
.none {display:none;}
</STYLE>
<SCRIPT type=text/javascript>
function nTabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
if (i == Num)
{
thisObj.className = "active";
document.getElementById(tabObj+"_Content"+i).style.display = "block";
}else{
tabList[i].className = "normal";
document.getElementById(tabObj+"_Content"+i).style.display = "none";
}
}
}
</SCRIPT>
<BR><BR>
<DIV style="PADDING-LEFT: 25px" align=center><!-- 选项卡0开始 -->
<DIV class=nTab><!-- 标题开始 -->
<DIV class=TabTitle>
<UL id=myTab2>
<LI class=active onmouseover=nTabs(this,0);>全部 </LI>
<LI class=normal onmouseover=nTabs(this,1);>日志 </LI>
<LI class=normal onmouseover=nTabs(this,2);>咨询 </LI>
<LI class=normal onmouseover=nTabs(this,3);>相册 </LI>
<LI class=normal onmouseover=nTabs(this,4);>商城 </LI>
<LI class=normal onmouseover=nTabs(this,5);>社区 </LI></UL></DIV><!-- 内容开始 -->
<DIV class=TabContent>
<DIV id=myTab2_Content0>000 </DIV>
<DIV class=none id=myTab2_Content1>111</DIV>
<DIV class=none id=myTab2_Content2>222</DIV>
<DIV class=none id=myTab2_Content3>333</DIV>
<DIV class=none id=myTab2_Content4>444</DIV>
<DIV class=none id=myTab2_Content5>555</DIV></DIV></DIV><!-- 选项卡0结束 --><!-- 选项卡1开始 -->
<DIV class=nTab style="WIDTH: 288px"><!-- 标题开始 -->
<DIV class=TabTitle>
<UL id=myTab1>
<LI class=active onclick=nTabs(this,0);>aaa </LI>
<LI class=normal onclick=nTabs(this,1);>bbb </LI>
<LI class=normal onclick=nTabs(this,2);>ccc </LI>
<LI class=normal onclick=nTabs(this,3);>单击 </LI></UL></DIV><!-- 内容开始 -->
<DIV class=TabContent>
<DIV id=myTab1_Content0>000 </DIV>
<DIV class=none id=myTab1_Content1>111 </DIV>
<DIV class=none id=myTab1_Content2>222 </DIV>
<DIV class=none id=myTab1_Content3>333 </DIV></DIV></DIV><!-- 选项卡1结束 --></DIV>