zoukankan      html  css  js  c++  java
  • [JS]视频总结-第四部分_JavaScript案例-定时器的使用

     <!doctype html> <html> <head> <meta charset="utf-8"> <title>定时器</title> <style> div {auto; height:100px; background:white; float:left; } #div1 {position:absolute; background:#F00; height:100px; 100px; left:0px; } /* #div2 {background:#0F0; height:100px; 100px; } #div3 {background:#00F; height:100px; 100px; } #div4 {background:#FF0; height:100px; 100px; } #div5 {background:#0FF; height:100px; 100px; }*/ </style> <script> window.onload=function() { setInterval(function() { var oDiv1=document.getElementById('div1'); oDiv1.style.left=oDiv1.offsetLeft+20+'px'; if(oDiv1.offsetLeft==1000) { oDiv1.style.left=0+'px'; } }, 100); }; </script> </head> <body> <div> <div id='div1'></div> <!--<div id='div2'></div> <div id='div3'></div> <div id='div4'></div> <div id='div5'></div> --> </div> </body> </html> 

     

  • 相关阅读:
    web.xml
    web.xml hello1代码分析
    annotation
    injection
    container
    build tool
    version control
    url与uri的区别
    函数式语言
    http协议解析过程
  • 原文地址:https://www.cnblogs.com/webapplee/p/3771682.html
Copyright © 2011-2022 走看看