谁有这样的代码给个谢谢

解决方案 »

  1.   

    http://topic.csdn.net/u/20100223/17/edb27cb3-24ff-461d-9cff-eb8b8816b6bf.html?64026
      

  2.   

    这个 就是在变化高度宽度的时候重新计算left ,top...
      

  3.   

    <script>
    var timer=null;
    window.onload=function(){
        timer=setInterval("resize()",50);
    }
    function resize(){
        var div=document.getElementsByTagName("div")[0];
        var w=parseInt(div.style.width);
        var h=parseInt(div.style.height);
        var t=parseInt(div.style.top);
        
        if(w==1 || h==1)clearInterval(timer);
        div.style.width = w-1;
        div.style.height = h-1;
        div.style.top = t+1;
    }
    </script>
    <div style="position:absolute;width:100px;height:100px;left:100px;top:100px;background:#eee;"></div>