Ahoj chtel bych si na stránky dát odpočítávání do urciteho dne v urcity mesic a rok (napr. 5.8.2015). A aby to bylo ve formatu hh:mm:ss dny.mesice.roky
Jak na to?
dik
Fórum › JavaScript, AJAX, jQuery
Odpočítávání

Ak ces pozri http://www.javascriptkit.com/script/cutindex1b.shtml najdes tam niejake tie skriptiky na odpocitavanie
Taky jsem to kdysi sháněl, tak tady to máš:
<body onLoad="startclock();">
<SCRIPT LANGUAGE="JavaScript">
var timerID = null;
var timerRunning = false;
function showtime() {
today = new Date();
BigDay = new Date("june 17, 2006")
msPerDay = 24 * 60 * 60 * 1000 ;
timeLeft = (BigDay.getTime() - today.getTime());
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_daysLeft = timeLeft / msPerDay;
daysLeft = Math.floor(e_daysLeft);
e_hrsLeft = (e_daysLeft - daysLeft)*24;
hrsLeft = Math.floor(e_hrsLeft);
minsLeft = Math.floor((e_hrsLeft - hrsLeft)*60);
hrsLeft = hrsLeft;
e_minsLeft = (e_hrsLeft - hrsLeft)*60;
secLeft = Math.floor(e_hrsLeft);
secLeft = Math.floor((e_minsLeft - minsLeft)*60);
secLeft = secLeft;
Temp3='Do 17. června 2006 zbývá '+daysLeft+' dní, '+hrsLeft+' hodin, '+minsLeft+' minut, '+secLeft+' sekund.'
document.frm.left.value=Temp3;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
var timerID = null;
var timerRunning = false;
function stopclock () {
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function stopClock() {
stopclock();
return;
}
function startclock () {
stopclock();
showtime();
}
// -->
</script>
<p align="center"><center>
<form name="frm"><input type="textarea" name="left" size="70" style="background-color: #FFFFFF; text-align: center; font: 10pt Verdana, Arial; border: 1px solid white"></form>
</center></p>
Pouprav si to jak potřebuješ, myslím, že kód je docela přehledný :smile2:

Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 16 hostů
Podobná vlákna
Odpočítávání — založil Tomik
Odpočítávání + Gauge — založil Navara
Odpočítávání do data — založil Miky
Odpočítávání.. (C++ VS6 sp5) — založil Ivo
Odpočítávání pomocí Labelu ve WPF — založil hejnallukas
Moderátoři diskuze