用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';"  οnmοuseοver="a()" οnmοuseοut="b()"></div>
</body>
</html>

版权声明:本文为feilong_12原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。