0

我已经在这里添加了代码当它在 11.00 之后到达星期五时,它应该倒计时到金钱 @ 11.00 有什么建议/帮助到达这里吗?另外: CountDown-timer 还应该能够检查它是否在丹麦这里度假(不确定这个功能,也许是一个控制该部分的数据库,因为假期会出现在变量中嗯?) http://jsfiddle。净/srwpyac0/24/

HTML:

<div id="countdown"></div>

JavaScript

function ShowTime() {
    var now = new Date();
    if (now.getHours() > 11) {
        var hrs = 11 - now.getHours() + 24;
    } else {
        var hrs = 11 - now.getHours();
    }
    var mins = 60 - now.getMinutes();
    var secs = 60 - now.getSeconds();

    timeLeft = "You now have " + hrs + ' Hour(s) ' + mins + ' minuts ' + secs + ' seconds' + " To complete the order, and make sure the delivery will reach to you in 1-3 days";
    $("#countdown").html(timeLeft);
}

var countdown;

function StopTime() {
    clearInterval(countdown);

}

setInterval(ShowTime, 1000);
4

1 回答 1

0

我不确定这是你想要的。请检查一次代码。

Javascript:

function ShowTime() {
  var now = new Date();
    if (now.getHours() > 11){
        var hrs =11-now.getHours()+24;
        if(now.getDay() == 5){
            var hrs = hrs + 48;
        }
    }else{
  var hrs = 11-now.getHours();
         }

  var mins = 60-now.getMinutes();
  var secs = 60-now.getSeconds();

      timeLeft = "You now have "+hrs+' Hour(s) '+mins+' minuts '+secs+' seconds' +" To complete the order, and make sure the delivery will reach to you in 1-3 days";
  $("#countdown").html(timeLeft);
}

var countdown;
function StopTime() {
    clearInterval(countdown);

}

setInterval(ShowTime ,1000);

小提琴:小提琴

于 2015-01-19T09:58:47.257 回答