1月4号首页LOGO很特别<img src=/logos/newton09-tree.jpg width=384 height=138 border=0 alt="艾萨克牛顿" title="艾萨克牛顿" id=logo  style="margin-top:-1.22em" onload="window.lol&&lol();setTimeout(function(){var h=0,v=1,f=document.getElementById('fall'),i=setInterval(function(){if(f){var r=parseInt(f.style.right)+h,b=parseInt(f.style.bottom)-v;f.style.right=r+'px';f.style.bottom=b+'px';if(b>-210){v+=2}else{h=(v>9)?v*0.1:0;v*=(v>9)?-0.3:0}}},25);google.rein&&google.rein.push(function(){clearInterval(i);h=0;v=1})},2000)"></a><img id="fall" src="/logos/newton09-apple.png" style="position:relative;right:248px;bottom:46px"/><noscript><style>#fall{bottom:-210px!important}</style></noscript>
以上代码没看明白  哪位给说说?

解决方案 »

  1.   

    页面js执行顺序
    1 setTimeout 页面打开后2秒 苹果下落开始
    2 setInterval 每间隔25毫秒执行 下落          f.style.right=r+'px'; //横坐标
              f.style.bottom=b+'px';//纵坐标
              
               if(b>-210){
                //下落
                v+=2
              } else{ 
                 //反弹
                h=(v>9)?v*0.1:0
                v*=(v>9)?-0.3:0
              }
    v<9 h=0 v=0 落地完成
      

  2.   

    上面的可以把CODE发好点的吗,这样看着别扭
      

  3.   

    setTimeout(function(){
    var h=0,v=1,
    f=document.getElementById('fall'),
    i=setInterval(
    function()
    {if(f){
    var r=parseInt(f.style.right)+h,
    b=parseInt(f.style.bottom)-v;
    f.style.right=r+'px';
    f.style.bottom=b+'px';
    if(b>-210)
    {v+=2
    }
    else
    {
    h=(v>9)?v*0.1:0;
    v*=(v>9)?-0.3:0;
    }
    }},1);
    google.rein&&google.rein.push(function(){clearInterval(i);h=0;v=1;})
    },1000)
      

  4.   

    上面再加上两图一苹果树图一苹果图就可以运行了在苹果树图加载的时候就运行这段代码fall就是苹果图片的id无非就是图片加载时间过两秒后运行然后以每25毫秒的速度垂直距离加2然后到了最低的时候总共设置的距离应该是到了210的时候就是第一次落地开始运行else条件里的V 和h的数值互相变化而改变到了 v<=9 后h为0图片静止
    这个数学好点的应该都可以做的来  还可以呵呵 其实就是通过一些公式运算数字然后通过运算结果影响坐标来实现位移的 
      

  5.   

    <html>
    <script language="javascript">
      var h=0,v=1;
      setTimeout(aa(),2000);
    function aa()
    {
      var i=self.setInterval("bb()",25);
    }function bb()
    {
      var f=document.getElementById('fall');
      var r=parseInt(f.style.right)+h;
      var b=parseInt(f.style.bottom)-v;
      f.style.right=r+'px';
      f.style.bottom=b+'px';
      if(b>-210){
           v+=2;
      }else{
          h=(v>9)?v*0.1:0;
          v*=(v>9)?-0.3:0;
      } }
    </script>
    <body>
    <div id="fall" style="position:relative;right:-300px;bottom:46px"> 
    apple
    </div> 
    </body>
    </html>
      

  6.   

    var apple = function() {  
        window.lol && lol();  
        setTimeout(  
        function() {  
            var h = 0, v = 1, f = document.getElementById('fall'),  
        i = setInterval(  
        function() {  
            if (f) {  
                var r = parseInt(f.style.right) + h, b = parseInt(f.style.bottom) - v;  
                f.style.right = r + 'px';  
                f.style.bottom = b + 'px';  
                if (b > -210) {  
                    v += 2  
                }  
                else {  
                    h = (v > 9) ? v * 0.1 : 0; v *= (v > 9) ? -0.3 : 0  
                }  
            }  
        }, 25);  
        }, 2000)  
    }  参见http://www.cnblogs.com/gudao119/archive/2010/01/04/1638668.html
      

  7.   

    http://www.cnblogs.com/gudao119/archive/2010/01/04/1638668.html