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> 

     

  • 相关阅读:
    Delphi语法
    orcad中注意的事情
    Express web框架
    Docker
    Node.JS
    再次 WebAssembly 技术探讨
    WebAssembly 浏览器中运行c/c++模块
    Http 服务 简单示例
    CentOS7 开放服务端口
    Go linux 实践4
  • 原文地址:https://www.cnblogs.com/webapplee/p/3771682.html
Copyright © 2011-2022 走看看