知识库

简洁大方的Tab选项卡的JS特效代码

来源: 本站    类别: 知识库    日期: 2016/7/1

 

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Tab选项卡</title>
<style type="text/css">
*{margin:0; padding:0; font-size:14px;}
#tablit {margin:50px;width:269px; height:400px; border:#BCE2F3 1px solid;padding-top:10px;background:#E4F2FB;}
#tablit dl{ float:left; width:298px;}
#tablit dl dt{float:left;border-bottom:#64B8E4 1px solid; width:15px; height:31px; line-height:30px;}
#tablit dl dd{float:left;width:110px;height:30px; line-height:30px; text-align:center;}
#tablit .on{border:#64B8E4 1px solid;border-bottom:#FFF 1px solid; color:#FF6600;background:#FFF;}
#tablit .out{border:#64B8E4 1px solid; color:#000;background:#64B8E4;}
.tabcon{width:100%; height:365px; background: #FFF; clear:both;}
.dis{display:none;}
</style>
</head>

<body>
<div id="tablit">
    <dl>
        <dt></dt>
        <dd class="on">今日涨幅前十</dd>
        <dt></dt>
        <dd class="out">今日跌幅前十</dd>
        <dt></dt>
    </dl>
 <div class="tabcon">A</div>
    <div class="tabcon dis">B</div>
</div>
</body>

<script type="text/javascript">

var mDD = document.getElementById("tablit").getElementsByTagName("dd");
var mDIV= document.getElementById("tablit").getElementsByTagName("div");


for (var i=0;i<mDD.length;i++){
 (function(index) {
  mDD[index].onmouseover = function() {
   if (mDD[index].className == 'out') {
    for (var j = 0; j < mDD.length; j++) {
     mDD[j].className = 'out';
     mDIV[j].style.display = 'none';
    }
    mDD[index].className = 'on';
    mDIV[index].style.display = 'block';
   }
  }

 })(i);
}

</script>

</html>


相关文章


Copyright © 2004 - 2024 CNHWW Inc. All Rights Reserved
石家庄市征红网络科技有限公司版权所有 邮政编码:050051
服务电话:0311-85315152 13931185013 在线客服QQ:81447932 / 81447933 邮箱: cnhww@163.com