我在我的网站上使用这个倒计时,here
您可以查看脚本here (太大,无法发布)
这是头部的代码:
<script type="text/javascript" src="javascripts/jquery.countdown.js"></script>
<script type="text/javascript">
$(function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);
$('.countdown-container').countdown({until: austDay});
$('#year').text(austDay.getFullYear());
});
</script>
我希望能够更改倒计时持续时间,希望能够更改为我想要的时间。
如果有人可以提供见解,那就太好了。
最佳答案
编辑:
var CommingDate = new Date();
CommingDate= new Date(CommingDate.getFullYear() + 1, 1 - 1, 26);
说明
日期(
CommingDate.getFullYear() + 1, 1 - 1, 26);
表示您希望将当前年份增加 1
日期(CommingDate.getFullYear() + 1,
1 - 1, 26);
第一个数字将向前移动一个月,因此如果您执行2 - 1
,则该月将为二月
但是如果您执行类似 1 - 1
的操作,这将导致获取当前月份
日期(CommingDate.getFullYear() + 1, 1 - 1,
26);
最后一个数字 26 将是您想要的日期
关于javascript - 更改倒计时持续时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14480254/