http://blog.csdn.net/jslang/article/details/37991517

解决方案 »

  1.   


    <!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>
    <title> new document </title>
    <style type="text/css">
    #aa {
    position:absolute;
    left:0px;
    top:0px;
    width:30px;
    height:30px;
    z-index:99;
    background-color: #ad7ee7;
    }
    </style>
    </head><body>
    <div id="aa"></div>
    <script type="text/javascript">
    var x=300, y=0, r=300, t=0;
    function run()
    {
    var tr = t*Math.PI/180;
    var tx = x-Math.cos(tr)*r;
    var ty = y+Math.sin(tr)*r;
    var aa = document.getElementById("aa");
    aa.style.left=tx+"px";
    aa.style.top=ty+"px";
    t+=1;
    if(t<=180)
    setTimeout(run,20);
    else
    aa.style.display="none";
    }
    run();
    </script>
    </body>
    </html>