世界时间

    技术2022-05-19  24

     <!--世界时间部分开始-->          <div class="worldtime">            <ul>

                  <li class="bj"><input id="bjthetime" size="8" class="InputTime"></li>              <li class="hk"><input id="hkthetime" size="8" class="InputTime"></li>              <li class="us"><input id="nkthetime" size="8" class="InputTime"></li>              <li class="uk"><input id="ldthetime" size="8" class="InputTime"></li>              <li class="au"><input id="xnthetime" size="8" class="InputTime"></li>              <li class="jp" style="display:none;"><input id="tkthetime" size="8" class="InputTime"></li>            </ul>          </div>        <!--世界时间部分结束--><script type="text/javascript">    //顶部世界各地时间显示部分    var timerID = null;    var timerRunning = false;    function stopclock() {        if (timerRunning)            clearTimeout(timerID);        timerRunning = false;    }    function startclock() {        stopclock();        showtime();    }    function showtime() {

            var now = new Date();        var hkhours = now.getHours();        var tkhours = now.getHours() + 2;        var ldhours = now.getHours() - 8;        var nkhours = now.getHours() - 13;        var xnhours = now.getHours() + 3;        var fkhours = now.getHours() - 7;        var prhours = now.getHours() - 7;        var minutes = now.getMinutes();        var seconds = now.getSeconds();

     

            var hktimeValue = "" + ((hkhours <= 12) ? " " : " ");        hktimeValue += (hkhours);        hktimeValue += ((minutes < 10) ? ":0" : ":") + minutes;        hktimeValue += ((seconds < 10) ? ":0" : ":") + seconds;

            var bjtimeValue = "" + ((hkhours <= 12) ? " " : " ");        bjtimeValue += (hkhours);        bjtimeValue += ((minutes < 10) ? ":0" : ":") + minutes;        bjtimeValue += ((seconds < 10) ? ":0" : ":") + seconds;

            var tktimeValue = "" + ((tkhours <= 12) ? " " : " ");        tktimeValue += ((hkhours >= 23) ? hkhours - 23 : hkhours + 1);        tktimeValue += ((minutes < 10) ? ":0" : ":") + minutes;        tktimeValue += ((seconds < 10) ? ":0" : ":") + seconds;        var ldtimeValue = "" + ((hkhours - 8 >= 12) ? " " : " ");        ldtimeValue += ((hkhours >= 8) ? hkhours - 8 : hkhours + 16);        ldtimeValue += ((minutes < 10) ? ":0" : ":") + minutes;        ldtimeValue += ((seconds < 10) ? ":0" : ":") + seconds;        var nktimeValue = "" + ((hkhours >= 12) ? " " : " ");        nktimeValue += ((hkhours >= 13) ? hkhours - 13 : hkhours + 11);        nktimeValue += ((minutes < 10) ? ":0" : ":") + minutes;        nktimeValue += ((seconds < 10) ? ":0" : ":") + seconds;        var xntimeValue = "" + ((hkhours + 3 <= 12) ? " " : " ");        xntimeValue += ((hkhours >= 21) ? hkhours - 21 : hkhours + 3);        xntimeValue += ((minutes < 10) ? ":0" : ":") + minutes;        xntimeValue += ((seconds < 10) ? ":0" : ":") + seconds;        var fktimeValue = "" + ((hkhours - 5 <= 12) ? " " : " ");        fktimeValue += ((hkhours >= 7) ? hkhours - 7 : hkhours + 17);        fktimeValue += ((minutes < 10) ? ":0" : ":") + minutes;        fktimeValue += ((seconds < 10) ? ":0" : ":") + seconds;

            document.getElementById("hkthetime").value = hktimeValue;        document.getElementById("tkthetime").value = tktimeValue;        document.getElementById("ldthetime").value = ldtimeValue;        document.getElementById("nkthetime").value = nktimeValue;        document.getElementById("xnthetime").value = xntimeValue;        document.getElementById("bjthetime").value = bjtimeValue;        timerID = setTimeout(showtime, 1000);        timerRunning = true;    } startclock();</script>


    最新回复(0)