标签:style http color io os 使用 ar java div
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>每天一个JavaScript实例-使用带有定时器的函数闭包</title> <style> #redbox{ position:absolute; left:100px; top:100px; width:200px; height:200px; background-color:red; } </style> </head> <body> <div id ="redbox"></div> <script> window.onload = function(){ document.getElementById("redbox").onclick = move; } function move(){ var x = 100; intervalId = setInterval(function(){x+=5;var left = x +"px";document.getElementById("redbox").style.left = left;},100) } </script> </body> </html>
标签:style http color io os 使用 ar java div
原文地址:http://blog.csdn.net/waiting7436/article/details/39651675