<script>
var i=0;
function show(){
if(i++>=20)return;
j=((Math.exp(-0.2*i))*(Math.cos(300*3.14*i)))
z.style.pixelLeft=Math.round(z.style.pixelLeft*j)
z.style.pixelTop=Math.round(z.style.pixelTop*j)
}
setInterval(show,1000);
</script>

解决方案 »

  1.   

    <script>
    var i=-1;
    function show(){
    if(++i>=20)return;
    j=((Math.exp(-0.2*i))*(Math.cos(300*3.14*i)))
    z.style.pixelLeft=Math.round(z.style.pixelLeft*j)
    z.style.pixelTop=Math.round(z.style.pixelTop*j)
    }
    setInterval(show,1000);
    </script>
      

  2.   

    不行啊。我现在用的是javascript1.2。好像可以不加;作为语句的结尾的。能帮我解释一下setInterval(show,1000)的意思吗?难道是每1秒钟做一次?
    那岂不浪费很多cpu资源?