js实现小球移动
css樣式代碼
<style>div{border: red 1px solid;border-radius:50%;width: 400px;height: 400px;position: absolute;} </style> html代碼 <div id="xq">小球 </div><button οnclick="aaa()">點(diǎn)我開始</button> <button οnclick="end()">點(diǎn)我結(jié)束</button>script里代碼
<script>var time ;function aaa(){time= window.setInterval("star()",100);}function star(){var node=document.getElementById("xq");var num= parseInt(window.getComputedStyle(node).left);num+=20;node.style.left=num+"px"; }function end(){window.clearInterval(time); }</script>總結(jié)
- 上一篇: SQLiteHelper帮助类
- 下一篇: 万科企业宗旨、愿景与核心价值观