我的网站上有倒计时,我希望它倒计时到下周日上午 11:00,当周日上午 11:01 我希望它自动倒计时到下周日上午 11:00,我希望它每个月重复一次。。
我有这个脚本,但似乎无法让它工作,有人可以帮我吗?
提前致谢
这是我的html...
<div class="eventtd">
<div class="nextevt">Next Service Start In:</div>
<div class="time" contents="2" rel="1374397200">
</div> <!-- end time -->
这是我使用的脚本,截至目前,当它达到 0 时,它会继续变为负值而不是重置。
jQuery(document).ready(function($) {
if (timerhelp == 'yes') {
var init = setInterval(animation, 100);
}
function animation(){
var deadline1 = $('.time').attr('rel');
var deadline2 = $('.time').attr('contents');
var now = new Date();
now = Math.floor(now / 1000);
now = now + Math.floor(deadline2 * 60 * 60);
var counter1 = deadline1 - now;
var seconds1=Math.floor(counter1 % 60);
if (seconds1 < 10 && seconds1 > 0 ){
seconds1 = '0'+seconds1;
}
counter1=counter1/60;
var minutes1=Math.floor(counter1 % 60);
if (minutes1 < 10 && minutes1 > 0){
minutes1 = '0'+minutes1;
}
counter1=counter1/60;
var hours1=Math.floor(counter1 % 24);
if (hours1 < 10 && hours1 > 0){
hours1 = '0'+hours1;
}
counter1=counter1/24;
var days1=Math.floor(counter1);
if (days1 < 10 && days1 > 0){
days1 = '0'+days1;
}
$('.time').html('<table><tbody><tr><th class="day">'+days1+'</th><th class="day">'+hours1+'</th><th class="day">'+minutes1+'</th><th class="day">'+seconds1+'</th></tr><tr><th>Days</th><th>Hours</th><th>Min</th><th>Sec</th></tr></tbody></table>');
}
});