我已经在这里添加了代码,当它在周五11点之后,它应该倒计时@ 11.00,有什么建议/帮助到这里吗?另外:倒计时器还应该能够检查在丹麦是否有一个假期(不确定这个函数,也许是一个数据库来控制这个部分,因为假期会有变量,嗯?) http://jsfiddle.net/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);
发布于 2015-01-19 09:58:47
我不确定这是你想要的。请检查一次密码。
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);
小提琴:小提琴
https://stackoverflow.com/questions/28021338
复制相似问题