Basic jQuery javascript countdown
I KNOW that this is basic. But I'm so JS-retarded I can't "do-it-myself" and I'm tired of spending hours getting nowhere. Please help!
There are dozens of JS countdowns I find by Googling & on jQuery.org. The one I'm trying to modify is http://plugins.jquery.com/project/tgcCountdown because it's the kind of BASIC counter I need. But it only offers the countdown based on a given SQL timestamp, and I need 开发者_StackOverflowa 2nd option of a fixed timer, e.g. 5 minutes from NOW.
Any advice? I know it's gotta be simple! secs = 300
or now.getTime() + 300
or something like that! I'm so close but I just can't get there!
// Using http://phrogz.net/JS/FormatDateTime_JS.txt
var fiveMinutesFromNow = new Date( (new Date)*1 + 1000 * 60 * 5 );
var timestamp = fiveMinutesFromNow.customFormat( '#YYYY##MM##DD##hhh##mm##ss#' );
console.log( timestamp );
// "20110207122917"
Edit to work for Firefox
精彩评论