1、编程实现:鼠标经过改变颜色
假设元素原本为红色,鼠标悬停,改为蓝色,鼠标离开,颜色还原
<!DOCTYPE html>
<html lang="zh-CH">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>移动</title>
<style>
#aa{
width: 200px;
height: 200px;
background-color: red;
}
#bb{
width: 200px;
height: 200px;
background-color: blue;
}
</style>
</head>
<body>
<div onmouseover="bb()" onmouseout="aa()" id="aa" ></div>
<script>
function aa(){
var a = document.getElementById("aa");
a.style.backgroundColor="b