zoukankan      html  css  js  c++  java
  • 关于setInterval的用法

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
     <TITLE>setInterval Method</TITLE>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
    <META NAME="AUTHOR" CONTENT="InetSDK">
    <META NAME="MS.LOCALE" CONTENT="EN-US">
    <META NAME="ROBOTS" CONTENT="noindex">


    <SCRIPT>
    var oInterval="";
    function fnStartInterval(){
     if(oInterval==""){
      oTimer.innerHTML="Interval Started";
      oInterval=window.setInterval("fnRecycle()",1000);
     }
     else{
      fnStopInterval();
     }
    }
    function fnStopInterval(){
     if(oInterval!=""){
      window.clearInterval(oInterval);
      oInterval="";
      oTimer.innerHTML="Interval Stopped";
     }
    }
    function fnRecycle(){
     var oDate=new Date();
     var sSwitch="am";
     var iHours=oDate.getHours();
     if(iHours>12){
      iHours-=12;
      sSwitch="pm";
     }
     var sMinutes=oDate.getMinutes() + "";
     if(sMinutes.length==1){
      sMinutes="0" + sMinutes;
     }
     var sSeconds=oDate.getSeconds() + "";
     if(sSeconds.length==1){
      sSeconds="0" + sSeconds;
     }
     oTimer.innerHTML=iHours + ":" + sMinutes + ":" + sSeconds + " " + sSwitch;


    }
    </SCRIPT>

    <!-- SAMPLE_STYLE_START -->
    <LINK REL="stylesheet" HREF="/workshop/basicSDKIE4.css"
    TYPE="text/css">
    <!-- SAMPLE_STYLE_END -->
    </HEAD>
    <!--TOOLBAR_START-->
    <!--TOOLBAR_EXEMPT-->
    <!--TOOLBAR_END-->

    <BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="#FFFFFF"
    LINK="#000000" VLINK="#808080" ALINK="#000000">
    <BLOCKQUOTE CLASS="body">

    <H1>setInterval Method</H1>
    <P>The <b>setInterval</b> method invokes a function or line of code every time the specified amount of time passes.
    In this sample, a function is called to update the <b>innerHTML</b> property of a <b>SPAN</b> with the current time every 1000 milliseconds, or every second.
    Click Start Interval to invoke the <b>setInterval</b> method.
    Click Stop Interval to remove the interval with the <b>clearInterval</b> method.
    </P>
    <SPAN ID=oTimer STYLE="font-size: 16pt; font-weight: bold; font-family: Times; color: #0000FF;">Interval Stopped</SPAN>
    <P>

    <INPUT TYPE=button VALUE="Start Interval" onclick="fnStartInterval()">
    <INPUT TYPE=button VALUE="Stop Interval" onclick="fnStopInterval()">


    <!-- START_PAGE_FOOTER -->
    <BR><BR><BR>
    &copy; <A CLASS="clsIncCpyRt" HREF="http://www.microsoft.com/isapi/gomscom.asp?TARGET=/info/cpyright.htm" TARGET="_top"> 2002 Microsoft Corporation. All rights reserved. Terms of use</A>.
    <!-- END_PAGE_FOOTER -->
    </BLOCKQUOTE>
    </BODY>
    </HTML>

  • 相关阅读:
    点击button先执行js在执行后台代码客户端判断控件是否为空
    VNC远程登录端使用经验之一
    TB平台搭建之一
    能力不足之 根据时序图转化为Verilog代码
    Verilog之语句位置
    verilog 1995 VS 2001 part1模块声明的扩展
    verilog $fopen 函数的小缺陷
    tab key usage
    poj2184 Cow Exhibition
    hdu2546 饭卡
  • 原文地址:https://www.cnblogs.com/xiaotaoliang/p/112676.html
Copyright © 2011-2022 走看看