|
|
|
สอบถามเรื่อง Countdown รีเฟลชแล้วไม่ให้เวลากลับไปเริ่มใหม่หน่อยคับ |
|
|
|
|
|
|
|
Code (Java)
$(function(){
var note = $('#note'),
ts = new Date(2012, 0, 1),
newYear = true;
if((new Date()) > ts){
// The new year is here! Count towards something else.
// Notice the *1000 at the end - time must be in milliseconds
ts = (new Date()).getTime() + 1*24*60*60*1000;
newYear = false;
}
$('#countdown').countdown({
timestamp : ts,
callback : function(days, hours, minutes, seconds){
var message = "";
message += days + " day" + ( days==1 ? '':'s' ) + ", ";
message += hours + " hour" + ( hours==1 ? '':'s' ) + ", ";
message += minutes + " minute" + ( minutes==1 ? '':'s' ) + " and ";
message += seconds + " second" + ( seconds==1 ? '':'s' ) + " <br />";
if(newYear){
message += "left until the new year!";
}
else {
message += "left to 10 days from now!";
}
note.html(message);
}
});
});
Tag : JavaScript, Ajax, jQuery
|
|
|
|
|
|
Date :
2013-03-29 10:26:26 |
By :
cmdping |
View :
1119 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองอ่านของคุณ deawx ดูครับ
มาเขียนสคริปนับถอยหลังแบบรีเฟรชแล้วเวลาไม่หายกันเถอะ
|
|
|
|
|
Date :
2013-03-29 12:38:24 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|