js缓冲效果原理
[task]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>js缓冲效果原理</title>
</head>
<body>
<div id="num">
</div>
<div id="ad" style="position:absolute;width:80px;height:100px;background:#0CC;"></div>
<script type="text/javascript">
var k=0;
function change(){
h=Math.ceil(0.1*(100-k));
k=k+h;
document.getElementById("num").innerHTML=k;
document.getElementById("ad").style.top=k+"px";
}
setInterval(change,100);
</script>
</body>
</html>
[/task]