我正在寻找延迟倒计时HTML代码...示例:

时间:2014-11-10 22:48:54

标签: html timer

我想要一个数字显示,经过这么多秒...... 让我们说15秒,这个数字将倒数一次.... 然后在这么多秒后再次重复。

例如,我希望看起来正在拍摄斑点。

我需要添加什么来获得我正在寻找的影响?
这是我正在使用的代码......

<center>
  <strong>
    <font face="Arial" size="6">
        <font color="#FFFF00">
            <script language="JavaScript" src="j.maxmind.com/app/geoip.js">;</script>
            ONLY
            <font color="#FF0000">7
                <font color="#FFFF00">SPOTS AVAILABLE NEAR<font color="##FF0000">
                    <script language="JavaScript">document.write(geoip_city());</script>,
                    <script language="JavaScript">document.write(geoip_region());</script>.
                </font>
            </font>
        </font>
    </strong> 
</center>

1 个答案:

答案 0 :(得分:-1)

<html>

<head>
  <script>
    var i = 7;

    function countdown() {
      if (i >= 0) {
        document.getElementById("counter").innerText = i;
        i = i - 1;
        setTimeout(function() {
          countdown()
        }, 15000);
      }
    }
  </script>
</head>

<body onload="countdown()">

  <center> <strong> <font face="Arial" size="6"> <font color="#FFFF00"> 
<script language="JavaScript" src="j.maxmind.com/app/geoip.js">; </script>ONLY <font color="#FF0000"><span id=counter>7</span> <font color="#FFFF00"> SPOTS AVAILABLE NEAR <font color="##FF0000"> <script language="JavaScript">document.write(geoip_city());</script>, <script language="JavaScript">document.write(geoip_region());</script>.</font> </font> </font> </strong> </center>
    
</body>

</html>