<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> 选项卡 </title>
<style type="text/css">
*{margin:0px;padding:0px;border:0px;}
#main{width:300px;height:300px;background-color:grey}
#head{height:50px;background-color:red}
#head li{float:left;height:50px;width:47px;list-style:none;line-height:50px;
margin-right:3px;background-color:yellow;}
</style>
<script type="text/javascript">
function show(n){
for(var i=1;i<=4;i++)
{
document.getElementById("p"+i).style.display = 'none';
document.getElementById("tab" + i).style.backgroundColor ='yellow';
}
document.getElementById("p" + n).style.display = 'block';
document.getElementById("tab" + n).style.backgroundColor ='grey';
}
</script>
</head>
<body>
<div id="main">
<div id="head">
<ul>
<li id="tab1" οnclick="show(1)" style="background-color:blue;">新闻</li>
<li id="tab2" οnclick="show(2)">体育</li>
<li id="tab3" οnclick="show(3)">娱乐</li>
<li id="tab4" οnclick="show(4)">八卦</li>
</ul>
</div>
<div id="neirong">
<p id="p1">南北朝鲜</p>
<p id="p2" style="display:none;">NBA</p>
<p id="p3" style="display:none;">娱乐乐翻天</p>
<p id="p4" style="display:none;">无极限</p>
</div>
</div>
</body>
</html>