展开全部
<html>
<head>
<title>test</title>
<style>
body {font-size:12px;background:#9EC7E7}
</style>
<script type="text/javascript">
function news(type){
for(i=1;i<=5;i++){
if(i==type){
document.getElementById(type).style.display="block";
}else{
document.getElementById(i).style.display="none";
}
}
}
</script>
</head>
<body >
<table>
<tr>
<td>
<div style="border:0px solid red;height:95px;width:250px;font-size:30;background:#FFFFFF" align="center" onclick="news(1)">
最新动态
</div>
<div style="border:0px solid red;height:95px;width:250px;background:#DE77D0" align="center" onclick="news(2)">1
</div>
<div style="border:0px solid red;height:95px;width:250px;background:#E29529" align="center" onclick="news(3)">2
</div>
<div style="border:0px solid red;height:95px;width:250px;background:#DE77D0" align="center" onclick="news(4)">3
</div>
<div style="border:0px solid red;height:95px;width:250px;background:#E29529" align="center" onclick="news(5)">4
</div>
</td>
<td width="230"></td>
<td>
<div id="1" style="border:1px solid #C7B1B3;height:125px;width:250px;">最新动态</div>
<div id="2" style="border:1px solid #C7B1B3;height:125px;width:250px;display:none;">1</div>
<div id="3" style="border:1px solid #C7B1B3;height:125px;width:250px;display:none;">2</div>
<div id="4" style="border:1px solid #C7B1B3;height:125px;width:250px;display:none;">3</div>
<div id="5" style="border:1px solid #C7B1B3;height:125px;width:250px;display:none;">4</div>
</td>
</tr>
</table>
</body>
</html>
把onclick 换成onmouseover就可以了
<head>
<title>test</title>
<style>
body {font-size:12px;background:#9EC7E7}
</style>
<script type="text/javascript">
function news(type){
for(i=1;i<=5;i++){
if(i==type){
document.getElementById(type).style.display="block";
}else{
document.getElementById(i).style.display="none";
}
}
}
</script>
</head>
<body >
<table>
<tr>
<td>
<div style="border:0px solid red;height:95px;width:250px;font-size:30;background:#FFFFFF" align="center" onclick="news(1)">
最新动态
</div>
<div style="border:0px solid red;height:95px;width:250px;background:#DE77D0" align="center" onclick="news(2)">1
</div>
<div style="border:0px solid red;height:95px;width:250px;background:#E29529" align="center" onclick="news(3)">2
</div>
<div style="border:0px solid red;height:95px;width:250px;background:#DE77D0" align="center" onclick="news(4)">3
</div>
<div style="border:0px solid red;height:95px;width:250px;background:#E29529" align="center" onclick="news(5)">4
</div>
</td>
<td width="230"></td>
<td>
<div id="1" style="border:1px solid #C7B1B3;height:125px;width:250px;">最新动态</div>
<div id="2" style="border:1px solid #C7B1B3;height:125px;width:250px;display:none;">1</div>
<div id="3" style="border:1px solid #C7B1B3;height:125px;width:250px;display:none;">2</div>
<div id="4" style="border:1px solid #C7B1B3;height:125px;width:250px;display:none;">3</div>
<div id="5" style="border:1px solid #C7B1B3;height:125px;width:250px;display:none;">4</div>
</td>
</tr>
</table>
</body>
</html>
把onclick 换成onmouseover就可以了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询