zoukankan      html  css  js  c++  java
  • 例子:倒计时按钮可用

    <div style="500px; height:500px; margin:100px 0px 0px 100px">

    <input id="btn" type="submit" value="确定" style="100px; height:35px" disabled="disabled" />

    <span id="daojishi">10</span>

    <div style="margin-top:20px">  

      <span id="h"></span>    

      <span id="m"></span>    

      <span id="s"></span> </div>

    </div>

    <script type="text/javascript">

    window.setTimeout("YanChi()",1000);

    function YanChi()

    {  

      var span = document.getElementById("daojishi");    

      //改变span里面的值  

      span.innerText = span.innerText-1;    

      //判断是否减到了0

       if(span.innerText == 0)

       {   

        document.getElementById("btn").removeAttribute("disabled");   

        return;

       }  

       window.setTimeout("YanChi()",1000);  

    }

    window.setInterval("Bian()",1000);

    function Bian()

    {  

      var sj = new Date();      

      document.getElementById("h").innerText = sj.getHours();  

      document.getElementById("m").innerText = sj.getMinutes();  

      document.getElementById("s").innerText = sj.getSeconds();  

    }

    </script>

  • 相关阅读:
    CentOS7.5 搭建MyCat1.6.6
    idea快速搭建springboot项目
    MySQL存储过程中变量及循环的使用
    windows 安装 jdk1.8并配置环境变量
    CentOS7.5安装JDK1.8
    CentOS7.2安装MySql5.7并开启远程连接授权
    PHP高级工程师面试
    每日英语
    静态化
    php分页实例及其原理
  • 原文地址:https://www.cnblogs.com/l5580/p/5909030.html
Copyright © 2011-2022 走看看