JavaScript简易动画

<p id="s">fly</p>

<script>

function move(){
var id=document.getElementById("s");
id.style.position="absolute";

if(!id.style.left){id.style.left="200px";}

if(id.style.left){
id.style.top="200px";}
var x1=parseInt(id.style.left); var y1=parseInt(id.style.top); if(x1<500){x1++} if(y1<450){y1++} id.style.left=x1+"px"; id.style.top=y1+"px"; setTimeout("move()",10); } move(); </script>

  

原文地址:https://www.cnblogs.com/rain-null/p/6526559.html