选项卡实现代码:
<!DOCTYPE html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
#biaodan {
height: 600px;
width: 365px;
padding-top: 100px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
font: "微软雅黑" 14px/30px;
}
body {
margin: 0px;
padding: 0px;
}
#shang{
height: 30;
text-align: center;
border-Top: 3px solid #060;
line-height: 30px;
vertical-align: middle;
}
#xia {
height: 500px;
}
#junshi ul ,#zhengzhi ul,#wenhua ul{
list-style-type: none;
}
a:link,a:visited,a:hover{
text-decoration:none;
}
#zhengzhi,#wenhua{
display:none;
}
#biaodan #sp-junshi{
width: 120px;
height: 29px;
border-left: 1px solid #666;
border-right: 1px solid #666;
float: left;
border-bottom: none;
background-color:none;
}
#biaodan #sp-zhengzhi{
width: 120px;
height: 29px;
border-right: 1px solid #666;
border-bottom: 1px solid #666;
background-color: #cfcfcf;
float: left;
}
#biaodan #sp-wenhua{
width: 120px;
height: 29px;
border-right: 1px solid #666;
border-bottom: 1px solid #666;
background-color: #cfcfcf;
float: left;
}
body {
margin: 0px;
padding: 0px;
}
</style>
<script>
function xianshijunshi(){
//军事显示
document.getElementById("junshi").style.display = "block";
//政治隐藏
document.getElementById("zhengzhi").style.display = "none";
//文化隐藏
document.getElementById("wenhua").style.display = "none";
document.getElementById("sp-junshi").style.background = "none"
document.getElementById("sp-zhengzhi").style.background ="#cfcfcf";
document.getElementById("sp-wenhua").style.background ="#cfcfcf";
document.getElementById("sp-junshi").style.borderBottom = "none";
document.getElementById("sp-zhengzhi").style.borderBottom = "1px solid #666";
document.getElementById("sp-wenhua").style.borderBottom = "1px solid #666";
}
function xianshizhengzhi(){
//军事隐藏
document.getElementById("junshi").style.display = "none";
//政治显示
document.getElementById("zhengzhi").style.display = "block";
//文化隐藏
document.getElementById("wenhua").style.display = "none";
document.getElementById("sp-junshi").style.background = "#cfcfcf"
document.getElementById("sp-zhengzhi").style.background ="none";
document.getElementById("sp-wenhua").style.background ="#cfcfcf";
document.getElementById("sp-junshi").style.borderBottom = "1px solid #666";
document.getElementById("sp-zhengzhi").style.borderBottom = "none";
document.getElementById("sp-wenhua").style.borderBottom = "1px solid #666";
}
function xianshiwenhua(){
//军事隐藏
document.getElementById("junshi").style.display = "none";
//政治隐藏
document.getElementById("zhengzhi").style.display = "none";
//文化显示
document.getElementById("wenhua").style.display = "block";
document.getElementById("sp-junshi").style.background = "#cfcfcf"
document.getElementById("sp-zhengzhi").style.background ="#cfcfcf";
document.getElementById("sp-wenhua").style.background ="none"
document.getElementById("sp-junshi").style.borderBottom = "1px solid #666";
document.getElementById("sp-zhengzhi").style.borderBottom = "1px solid #666";
document.getElementById("sp-wenhua").style.borderBottom = "none";
}
</script>
</head>
<body>
<div id="biaodan">
<div id="shang" >
<div id="sp-junshi" class="s1" onMouseover="xianshijunshi()">军事</div>
<div id="sp-zhengzhi" class="s2" onMouseover="xianshizhengzhi()">政治</div>
<div id="sp-wenhua" class="s3" onMouseover="xianshiwenhua()">文化</div>
<div style="clear:both;"></div>
</div>
<div id="xia">
<div id="junshi" class ="info">
<ul>
<li><a href="#">军事军事军事军事军事军事军事军事</a></li>
<li><a href="#">军事军事军事军事军事军事军事军事</a></li>
<li><a href="#">军事军事军事军事军事军事军事军事</a></li>
<li><a href="#">军事军事军事军事军事军事军事军事</a></li>
<li><a href="#">军事军事军事军事军事军事军事军事</a></li>
<li><a href="#">军事军事军事军事军事军事军事军事</a></li>
</ul>
</div>
<div id="zhengzhi" class ="info">
<ul>
<li><a href="#">政治政治政治政治政治政治政治政治</a></li>
<li><a href="#">政治政治政治政治政治政治政治政治</a></li>
<li><a href="#">政治政治政治政治政治政治政治政治</a></li>
<li><a href="#">政治政治政治政治政治政治政治政治</a></li>
<li><a href="#">政治政治政治政治政治政治政治政治</a></li>
<li><a href="#">政治政治政治政治政治政治政治政治</a></li>
</ul>
</div>
<div id="wenhua" class ="info">
<ul>
<li><a href="#">文化文化文化文化文化文化文化文化</a></li>
<li><a href="#">文化文化文化文化文化文化文化文化</a></li>
<li><a href="#">文化文化文化文化文化文化文化文化</a></li>
<li><a href="#">文化文化文化文化文化文化文化文化</a></li>
<li><a href="#">文化文化文化文化文化文化文化文化</a></li>
<li><a href="#">文化文化文化文化文化文化文化文化</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
选项卡实现页面