日期:2014-05-16  浏览次数:20352 次

用js实现鼠标移出移进变换颜色
<html>
<head>
<meta charset="utf-8"/>
<script>
function a(){
var red=document.getElementById('div1');
red.style.backgroundColor="blue";
}
function b(){
var red=document.getElementById('div1');
red.style.backgroundColor="red";
}
</script>
</head>
<body >
<div id="div1" style="width:120px;height:120px;background-Color:'red';"  onmouseover="a()" onmouseout="b()"></div>
</body>
</html>