Countdown Script

Does anyone know of a good countdown script… Ive found some but they dont work to well. It doesnt have to be dynamic, static is fine.
Thanks

See if this one helps
http://www.kirupaforum.com/forums/showthread.php?s=&threadid=30013&highlight=timer

Im looking more for a count down from the curent date and time to a specified date and time.

Hmm ok i get it.

[AS]onClipEvent (load) {
var H = 11, M = 56, S = 30;// target hour, minute and second
}
onClipEvent (enterFrame) {
var myDate = new Date();
var hours = myDate.getHours();
var minutes = myDate.getMinutes();
var seconds = myDate.getSeconds();
var myhours = (hours<10) ? “0”+hours : hours;
var myminutes = (minutes<10) ? “0”+minutes : minutes;
var myseconds = (seconds<10) ? “0”+seconds : seconds;
(hours == H && minutes == M && seconds == S) ? trace(“OK”) : null;
}[/AS]

I don’t know what it’s worth but here’s a prototype by di-de from www.flash-france.com

date.prototype.decompteDate = function(annee, mois, jour, heure) {
        dateEntree = new Date(Number(annee), Number(mois)-1, Number(jour), Number(heure));
        maintenant = new Date();
        diffbis = 0;
        diffmillisecondes = Math.abs(dateEntree-maintenant);
        for (i=(Math.min(annee, maintenant.getFullYear()))+1; i<=(Math.max(annee, maintenant.getFullYear())-1); i++) {
                if (i%400 == 0 || (i%4 == 0 && i%100 != 0)) {
                        diffbis += 1;
                }
        }
        if (maintenant.getFullYear()%400 == 0 || (maintenant.getFullYear() == 0 && maintenant.getFullYear()%100 != 0)) {
                if (maintenant.getMonth()<2 && dateEntree.getFullYear()>maintenant.getFullYear()) {
                        diffbis += 1;
                }
                if (maintenant.getMonth()>=2 && dateEntree.getFullYear()<maintenant.getFullYear()) {
                        diffbis += 1;
                }
        }
        if (dateEntree.getFullYear()%400 == 0 || (dateEntree.getFullYear() == 0 && dateEntree.getFullYear()%100 != 0)) {
                if (dateEntree.getMonth()<2 && dateEntree.getFullYear()<maintenant.getFullYear()) {
                        diffbis += 1;
                }
                if (dateEntree.getMonth()>=2 && dateEntree.getFullYear()>maintenant.getFullYear()) {
                        diffbis += 1;
                }
        }
        diffmillisecondes -= (diffbis*86400000);
        diffans = Math.floor(diffmillisecondes/31536000000);
        diffjours = Math.floor((diffmillisecondes%31536000000)/86400000);
        if (diffjours<10) {
                diffjours = "0"+diffjours;
        }
        diffheures = Math.floor((diffmillisecondes%86400000)/3600000);
        if (diffheures<10) {
                diffheures = "0"+diffheures;
        }
        diffminutes = Math.floor((diffmillisecondes%3600000)/60000);
        if (diffminutes<10) {
                diffminutes = "0"+diffminutes;
        }
        diffsecondes = Math.floor((diffmillisecondes%60000)/1000);
        if (diffsecondes<10) {
                diffsecondes = "0"+diffsecondes;
        }
        return diffans+" an(s), "+diffjours+" jour(s), "+diffheures+" heure(s), "+diffminutes+"minutes(s), "+diffsecondes+" seconde(s)";
};

 
//Usage 


maDate=new Date();
monChamps=maDate.decompteDate((a)aaa,(m)m,(j)j,h(h));
//n'entrez qu'un chiffre si le mois, le jour ou l'heure sont inférieurs à 10
//les mois commencent à janvier=1....décembre=12
//ex:3 février 1985, 9h -> (1985,2,3,9)

Americans are too lazy to be bilingual :wink:

Cool Ilyas, thats a scary huge prototype :!:
Ill take a look at it.
:slight_smile:

Yeah, it is a bit huge (and a bit French), sorry about that :-\ I’m sure there are ways to trim.