标签:IV bsp 分享 app pos javascrip set idt osi
1、使方块移动
源码 :
<script type="text/javascript">
var div = document.createElement(‘div‘);
document.body.appendChild(div);
div.style.width = "100px";
div.style.height = "100px";
div.style.background = "red";
div.style.position = "absolute";
div.style.left = "0px";
div.style.top = "0px";
//每隔50毫秒执行该函数。
setInterval(function(){
div.style.left = parseInt(div.style.left) + 5 + "px";
div.style.top = parseInt(div.style.top) + 5 + "px";
},50);
</script>
截图:
标签:IV bsp 分享 app pos javascrip set idt osi
原文地址:https://www.cnblogs.com/2016-zck/p/9215633.html