使用这个jquery倒计时脚本http://keith-wood.name/countdown.html,如下所示:
<script type="text/javascript">
$(function () {
var today = new Date();
var tomorrow = new Date();
tomorrow.setDate(today.getDate() + 1);
var tm = new Date(tomorrow.getFullYear(),tomorrow.getMonth(), tomorrow.getDate());
$('#defaultCountdown').countdown({until: tm});
});
</script>
和这个
<div id="defaultCountdown"></div>
允许我根据电脑时间24小时显示倒计时。现在我也希望得到这个日期但我不想要当前日期我想要第二天的日期
答案 0 :(得分:0)
我不确定你的插件是否允许这种功能,所以你必须自己制作这样的功能:
<style>
#tomorrow{
width: 240px;
height: 45px;
margin-bottom:10px;
}
#tomorrow .countdown-section{
padding-left:5px;
}
</style>
<div id="tomorrow" class="is-countdown">
<span class='countdown-section'><span class='countdown-amount' id='tomorrowDay'></span><span class='countdown-period'>Day</span></span>
<span class='countdown-section'><span class='countdown-amount' id='tomorrowDate'></span><span class='countdown-period'>Date</span></span>
<span class='countdown-section'><span class='countdown-amount' id='tomorrowMonth'></span><span class='countdown-period'>Month</span></span>
</div>
<script>
function setTomorrow(){
var today = new Date();
var tomorrow = new Date();
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(0);
tomorrow.setMinutes(0);
tomorrow.setSeconds(0);
tomorrow.setMilliseconds(0);
var timer = (tomorrow - today);
$("#tomorrowDay").text(['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][tomorrow.getDay()]);
$("#tomorrowDate").text(tomorrow.getDate());
$("#tomorrowMonth").text(['January','February','','March','April','May','June','July','August','September','October','November','December'][tomorrow.getMonth()]);
setTimeout(function(){ setTomorrow(); }, timer);
}
setTomorrow();
</script>