在这个倒计时功能中,我在哪里更改日期
Where do I change the date in this countdown function?
我刚刚下载了这个倒计时脚本(JavaScript),但我不知道如何更改计时器倒计时的日期。原始脚本:
$(function(){
var now = new Date();
// comment out the line below and change the date of your countdown here
var in30Days = new Date( now.getTime() + (30 * 24 * 60 * 60 * 1000) );
// year to countdown to
var countdownYear = in30Days.getFullYear();
// month to countdown to 0 = Jan, 1 = Feb, etc
var countdownMonth = in30Days.getMonth();
// day to countdown to
var countdownDay = in30Days.getDate();
var countdownDate = new Date( countdownYear, countdownMonth, countdownDay );
setupCountdownTimer( countdownDate );
spaceParallax();
hideIphoneBar();
$("[placeholder]").togglePlaceholder();
setupSignupForm();
});
也许倒计时日期。。。默认情况下,它是用现在+30天构建的?你可以改变这个。
重要部分是:
setupCountdownTimer( countdownDate );
spaceParallax();
hideIphoneBar();
$("[placeholder]").togglePlaceholder();
setupSignupForm();
});
您的代码本身告诉如何做到这一点:
// comment out the line below and change the date of your countdown here
var in30Days = new Date( now.getTime() + (30 * 24 * 60 * 60 * 1000) );
// year to countdown to
var countdownYear = in30Days.getFullYear();
// month to countdown to 0 = Jan, 1 = Feb, etc
var countdownMonth = in30Days.getMonth();
// day to countdown to
var countdownDay = in30Days.getDate();
下面一行创建countDownDate,将年、月和日传递给函数
var countdownDate = new Date( countdownYear, countdownMonth, countdownDay );
setupCountdownTimer( countdownDate );
相关文章:
- 在哪里使用名为“;冻结”;
- Ember.js-接口状态应该存储在哪里
- 在Redux中,我应该在哪里编写复杂的异步流
- 在哪里可以学习ECMAScript标准中尚未包含的JavaScript功能
- 在哪里可以找到RXUI Javascript'时间飞逝'实例
- Redux应用程序结构-在哪里放置服务/业务逻辑
- 在哪里可以找到'项目'在plothover函数中
- Javascript-在哪里放置常量,全局或本地
- Sequelize:这些方法应该驻留在哪里
- AJAX更新面板不;t工作.请帮我找出我错在哪里.
- 在哪里存储HTML模板以在Backbone.js中使用
- ForerunnerDB将其数据库保存在哪里
- 在哪里可以找到R-to-JavaScript编译器
- 很棒的共享按钮application.coffee文件在哪里
- WinJs中的视图状态更改事件在哪里
- 如何/在哪里从redux应用程序中的服务器转换日期
- 我的javascript中的错误在哪里?转换日期格式
- 在这个倒计时功能中,我在哪里更改日期
- jQuery UI日期选择器的i18n文件在哪里>=1.11.0
- 如何比较日期以查看相邻时间在哪里相遇