Autor Zpráva
drevus
Profil *
Tohle je celý zdroj kod:


//<![CDATA[
function countdown(sts,seconds){
var targetDate = new Date("July 11, 2008 05:00:00 GMT");
var currentDate = new Date();
var timeDiff = Math.round((targetDate-currentDate)/1000);

/**
* set number of seconds in each time unit
*/
var oneMinute = 60;
var oneHour = 60*60;
var oneDay = 60*60*24;
var oneYear = 60*60*24*364.25;

/**
* count number of time units and pending seconds
*/
var remYears = Math.floor(timeDiff/oneYear);
var remDays = Math.floor((timeDiff-remYears*oneYear)/oneDay);
var remHours = Math.floor((timeDiff-remYears*oneYear-remDays*oneDay)/oneHour);
var remMinutes = Math.floor((timeDiff-remYears*oneYear-remDays*oneDay-remHours*oneHour) /oneMinute);
var remSeconds = Math.floor(timeDiff-remYears*oneYear-remDays*oneDay-remHours*oneHour-r emMinutes*oneMinute);

/**
* count pending "miliseconds"
*/
if(remSeconds==seconds){
sts--;
if(sts==-1) sts = 9;
}else{
sts = 9;
}

/**
* create text according to number of units left
*/
var textYears = "let";
if(remYears==1) textYears = "let";

var textDays = "dní";
if(remDays==1) textDays = "dní";

var textHours = "hodin";
if(remHours==1) textHours = "hodin";

var textMinutes = "minut";
if(remMinutes==1) textMinutes = "minut";

var textSeconds = "sekund";
if(remSeconds==1) textSeconds = "sekund";

/**
* return result as text string
*/
var string = remDays+" "+textDays+" "+remHours+" "+textHours+" "+remMinutes+" "+textMinutes+" "+remSeconds+"."+sts+" "+textSeconds+"";

/**
* display counter
*/
if(timeDiff>0){
document.getElementById("timer").innerHTML = string;
setTimeout("countdown("+sts+","+remSeconds+");", 100);
}else{
document.getElementById("text").style.display = "none";
document.getElementById("timer").innerHTML = "vysílá se...";
}
}
//]]>


Potrebuju tenhle odpocet v javascriptu dostat do stránky prosím pomoc DEKUJI
jakubroz
Profil
a co na tom vidíš za problém?
akorád to dáš mezi <script></script>
Měsíček
Profil
Tohle šupni do hlavičky:

<script type="text/javascript">

function countdown(sts,seconds){ 
var targetDate = new Date("July 11, 2008 05:00:00 GMT"); 
var currentDate = new Date(); 
var timeDiff = Math.round((targetDate-currentDate)/1000); 

/** 
* set number of seconds in each time unit 
*/ 
var oneMinute = 60; 
var oneHour = 60*60; 
var oneDay = 60*60*24; 
var oneYear = 60*60*24*364.25; 

/** 
* count number of time units and pending seconds 
*/ 
var remYears = Math.floor(timeDiff/oneYear); 
var remDays = Math.floor((timeDiff-remYears*oneYear)/oneDay); 
var remHours = Math.floor((timeDiff-remYears*oneYear-remDays*oneDay)/oneHour); 
var remMinutes = Math.floor((timeDiff-remYears*oneYear-remDays*oneDay-remHours*oneHour) /oneMinute); 
var remSeconds = Math.floor(timeDiff-remYears*oneYear-remDays*oneDay-remHours*oneHour-r emMinutes*oneMinute); 

/** 
* count pending "miliseconds" 
*/ 
if(remSeconds==seconds){ 
sts--; 
if(sts==-1) sts = 9; 
}else{ 
sts = 9; 
} 

/** 
* create text according to number of units left 
*/ 
var textYears = "let"; 
if(remYears==1) textYears = "let"; 

var textDays = "dní"; 
if(remDays==1) textDays = "dní"; 

var textHours = "hodin"; 
if(remHours==1) textHours = "hodin"; 

var textMinutes = "minut"; 
if(remMinutes==1) textMinutes = "minut"; 

var textSeconds = "sekund"; 
if(remSeconds==1) textSeconds = "sekund"; 

/** 
* return result as text string 
*/ 
var string = remDays+" "+textDays+" "+remHours+" "+textHours+" "+remMinutes+" "+textMinutes+" "+remSeconds+"."+sts+" "+textSeconds+""; 

/** 
* display counter 
*/ 
if(timeDiff>0){ 
document.getElementById("timer").innerHTML = string; 
setTimeout("countdown("+sts+","+remSeconds+");", 100); 
}else{ 
document.getElementById("text").style.display = "none"; 
document.getElementById("timer").innerHTML = "vysílá se..."; 
} 
} 
</script>
drevus
Profil *
Dal jsem to do hlavičky a nic chyba řádek 23 znak 89

Vaše odpověď

Mohlo by se hodit

Neumíte-li správně určit příčinu chyby, vkládejte odkazy na živé ukázky.
Užíváte-li nějakou cizí knihovnu, ukažte odpovídajícím, kde jste ji vzali.

Užitečné odkazy:

Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm: