zoukankan      html  css  js  c++  java
  • JQuery计时器

    //引用JQuery

    <script src="http://www.cnblogs.com/Scripts/jquery-1.4.1.js" type="text/javascript"></script>

    <script language="javascript">

    //定时器
        var se, m = 0, h = 0, s = 0;
        function second() {
            if (s > 0 && (s % 60) == 0) { m += 1; s = 0; }
            if (m > 0 && (m % 60) == 0) { h += 1; m = 0; }
            t = (h <= 9 ? "0" + h : h) + ":" + (m <= 9 ? "0" + m : m) + ":" + (s <= 9 ? "0" + s : s);
            document.getElementById("showtime").value = t;
            s += 1;
        }
        $(document).ready(function startclock() { se = setInterval("second()", 1000); });
        function pauseclock() { clearInterval(se); }
        function stopclock() { clearInterval(se); m = h = s = 0; }
    </script>

     <input type="text" name="showtime" id="showtime" readonly=readonly style=" 80px; border:0px;font-size:20px;background-color:RGB(72,254,3);" value="00:00:00">

    效果如下图:

    .

  • 相关阅读:
    Aizu
    Aizu
    POJ
    POJ
    POJ
    UVA
    manacher
    Gym
    Gym
    Gym
  • 原文地址:https://www.cnblogs.com/xingyuan13/p/2445215.html
Copyright © 2011-2022 走看看