日期:2014-05-16 浏览次数:20390 次
<html> <head> <title></title> <script type="text/javascript"> //让图片每秒左移10像素 var imgdo = null; function imgmove(){ imgdo = document.getElementById("imgdo"); imgdo.style.left = leftpx; imgdo.style.left = leftpx - 10; window.setTimeout('imgmove()',1000); } window.setTimeout('imgmove()',100) </script> </head> <body> <img src="ic_launcher.png" style="position :absolute ;left : 400px; top:400px" id="imgdo" /> </body> </html>
<html> <head> <title></title> <script type="text/javascript"> //让图片每秒左移10像素 var imgdo = null; function imgmove(){ imgdo = document.getElementById("imgdo"); leftpx = parseInt(imgdo.style.left); imgdo.style.left = leftpx - 10 + 'px'; window.setTimeout('imgmove()',1000); } window.setTimeout(imgmove, 100) </script> </head> <body> <img src="http://avatar.profile.csdn.net/8/D/B/2_tankun2011.jpg" style="position :absolute ;left : 400px; top:400px" id="imgdo" /> </body> </html>