标签:java 服务中心 type rip 产品 round element 恢复 mouse
<style type="text/css">
#caidan{
width:500px; height:35px; border:1px solid #60F;
}
.xiang{
width:100px;
height:35px;
text-align:center;
line-height:35px;
vertical-align:middle;
float:left;
}
</style>
</head>
<body>
<div id="caidan">
<div class="xiang" onmouseover="huan(this)" >首页</div>
<div class="xiang" onmouseover="huan(this)" >产品中心</div>
<div class="xiang" onmouseover="huan(this)" >服务中心</div>
<div class="xiang" onmouseover="huan(this)" >联系我们</div>
</div>
</body>
<script type="text/javascript">
function huan(a)
{
//将所有的项恢复原样式
var d = document.getElementsByClassName("xiang");
for(var i=0;i<d.length;i++)
{
d[i].style.backgroundColor="white";
d[i].style.color = "black";
}
//换该元素的样式
a.style.backgroundColor = "red";
a.style.color = "white";
}
/*function huifu(a)
{
a.style.backgroundColor = "white";
a.style.color = "black";
}*/
</script>
标签:java 服务中心 type rip 产品 round element 恢复 mouse
原文地址:http://www.cnblogs.com/qdlj/p/6188260.html