Original: http://www.cnblogs.com/thinkgao/p/3333491.html
Here is the code I improved:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<style>
#animation {
width:500px;
height:500px;
Background-color: #f00;
}
</style>
<body>
<div id= "Animation" ></div>
<script>
(function () {
var someanimation=function (Thenode,args) {
Thenode.style.opacity=args;
};
var Animation=document.getelementbyid ("animation");
var todofunc=function (POS) {
return function () {
Someanimation (Animation,pos);
}
};
SetInterval (function () {
for (Var i=0;i<10;i+=1) {
SetTimeout (Todofunc (I/10), i*100);
}
},2000);
})();
</script>
</body>
Using JS to achieve the animation [mining the Stone of the mountain to improve, thank you]