第一个比较杂乱的动画

Original 2018-12-22 18:03:54 252
abstract:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>小动画</title></head><body><script type="text/javascript">function over(b

<!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的用法有点懵,居然发现传值名称可以相同。

Correcting teacher:天蓬老师Correction time:2018-12-22 18:32:49
Teacher's summary:this, 代表当前的执行环境, 或者方法的调用者, 本意就是"这个"

Release Notes

Popular Entries