<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
*{
       margin: 0;
       padding: 0;
   }
   #par_div{
       margin-left: 200px;
       margin-top: 200px;
       float: left;
       height: 200px;
       width: 320px;
   }
   .list{
       height: 42px;
       width: 320px;
	   margin-left: 1px;
   }
.list li{
   list-style-type: none;
   width: 60px;
   height: 40px;
   line-height: 40px;
   text-align: center;
   display: inline-block;
   float: left;
   border-left: 1px solid #336699;
   border-right: 1px solid #336699;
   border-top: 1px solid #336699;
   margin-left: -1px;
}
.list li a{
   text-decoration: none;
   color: darkgray;
   display: block;
}
div#news1 {
    margin-top: -2px;
    z-index: -1;
}
.news{
   clear: both;
   line-height: 25px;
   height: 158px;
   width: 320px;
   border:1px solid #336699;
   padding: 5px;
}
#new3,#news2{
   display: none;
}
</style>
</head>
<body>
<div id="par_div">
   <ul class="list">
       <li><a href="#">房产</a></li>
       <li><a href="#">家居</a></li>
       <li><a href="#">二手房</a></li>
   </ul>
   <div class="news" id="news1">
       <p>275万购昌平邻铁三居 总价20万买一居</p>
       <p>200万内购五环三居 140万安家东三环</p>
       <p>北京首现零首付楼盘 53万购东5环50平</p>
       <p>京楼盘直降5000 中信府 公园楼王现房</p>
   </div>
   <div class="news" id="news2">
       <p>40平出租屋大改造 美少女的混搭小窝</p>
       <p>经典清新简欧爱家 90平老房焕发新生</p>
       <p>新中式的酷色温情 66平撞色活泼家居</p>
       <p>瓷砖就像选好老婆 卫生间烟道的设计</p>
   </div>
   <div class="news" id="new3">
       <p>275万购昌平邻铁三居 总价20万买一居</p>
       <p>200万内购五环三居 140万安家东三环</p>
       <p>北京首现零首付楼盘 53万购东5环50平</p>
       <p>京楼盘直降5000 中信府 公园楼王现房</p>
</div>
</div>
</body>
</html>怎么添加上js,让效果变成点击房产的时候显示房产的内容,点击家居的时候显示家居的内容呢
//多看看javascript入门篇3-5display属性; //可以给分别a标签添加一个点击函数; <a onclick="house()" href="#">房产</a> <a onclick="home()" href="#">家居</a> <a onclick="hdshome()" href="#">二手房</a>
<script type=text/javascript>
function house()
	{
		document.getElementById("news1").style.display = "block";
		document.getElementById("news2").style.display = "none";
		document.getElementById("new3").style.display = "none";
		
	}
	function home()
	{
		document.getElementById("news1").style.display = "none";
		document.getElementById("news2").style.display = "block";
		document.getElementById("new3").style.display = "none";
	}
	function hdshome()
	{
		document.getElementById("news2").style.display = "none";
		document.getElementById("new3").style.display = "block";
		document.getElementById("news1").style.display = "none";
	}
</script>
//不知道这是不是你想要的

。。。。
哇 楼主 本来很简单的问题 你的news1和2都是news 怎么到了3就成了new3。。。整得我找了半天错误。截图已奉上 请放心食用。