<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>小动画</title>
</head>
<body>
<script type="text/javascript">
function over(bian){
bian.style.background="magenta";
}
function myclick(donghua){
donghua.style.borderRadius="50px";
donghua.style.background="red";
donghua.style.width="100px";
donghua.style.height="100px";
}
function out(bian) {
bian.style.background="blue";
bian.style.width="120px";
bian.style.height="120px";
bian.style.borderRadius="60px";
}
</script>
<div style="width:100px;height:100px;border:1px solid #ccc;background: pink;" onmouseover="over(this)" onclick="myclick(this)" onmouseout="out(this)"></div>
</body>
</html>
总结:模仿写法,练习写法,熟能生巧。this的用法有点懵,居然发现传值名称可以相同。