0

如何每周循环一次Keith Wood 的倒数计时器?以每周为单位,我的意思是计时器每次用完时应该增加 7 天。我试着想出这段代码,但它不起作用。

$(function () {
    var testing = new Date();
    testing = new Date(2013, 5, 24, 16, 0, 0);
    $('#nextCountdown').countdown({until: testing, timezone: +9, onExpiry: newWeek});
});

function newWeek() {
    testing.setDate(testing.getDate() + 7);
}
4

2 回答 2

0
testing = new Date(testing.valueOf() + 604800000) 

定时器增加一周

于 2013-06-24T08:17:44.170 回答
0

这一定是由于时区问题。尝试更改时区。例如 2

timezone: +2,

请访问http://jsfiddle.net/suhailvs/9UQxq/

IE

<p id="defaultCountdown"></p>
<script>
var newYear = new Date(); 
newYear = new Date(2013, 5, 24, 17, 0, 0); 
//$('#defaultCountdown').countdown({until: newYear}); 
$('#defaultCountdown').countdown({until: newYear, timezone: +2,onExpiry:newWeek});


function newWeek() {
    testing.setDate(testing.getDate() + 7);
}
</script>
于 2013-06-24T08:23:12.287 回答