<!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>