Két kód, válassz! :)
1.Kód:
<SCRIPT language=JavaScript type=text/javascript></P> <P>document.write(' <FONT color=#ff0000>Karácsonyig hátralévő idő</FONT>:<br /><b><div id="winerCountdown"></div></b>');</P> <P>winerClockCountdown();</P> <P>function toDateString(strTempString) {</P> <P>strReturnString = "";</P> <P>if (strTempString < 10) {</P> <P>strReturnString += "0";</P> <P>}</P> <P>return strReturnString + strTempString.toString();</P> <P>}</P> <P></P> <P>function winerClockCountdown() {</P> <P>var strEventDate = new Date("December 24, 2006 20:00:00 GMT+2");</P> <P>// cl = document.clock;</P> <P>newDate = new Date();</P> <P>intCount = Math.floor((strEventDate.getTime() - newDate.getTime())/1000);</P> <P>if(intCount <= 0) {</P> <P>return;</P> <P>}</P> <P>intSeconds = toDateString(intCount % 60);</P> <P>intCount = Math.floor(intCount / 60);</P> <P>intMinutes = toDateString(intCount % 60);</P> <P>intCount = Math.floor(intCount / 60);</P> <P>intHours = toDateString(intCount % 24);</P> <P>intCount = Math.floor(intCount / 24);</P> <P>intDays = intCount; </P> <P>document.getElementById("winerCountdown").innerHTML = </P> <P>intDays + " <FONT color=#ff0000>Nap</FONT>, " + </P> <P>intHours + " <FONT color=#ff0000>Óra</FONT>, " + </P> <P>intMinutes + " <FONT color=#ff0000>Perc</FONT>, " + </P> <P>intSeconds + " <FONT color=#ff0000>Másodperc</FONT>"; </P> <P></P> <P>setTimeout("winerClockCountdown();", 500);</P> <P></P> <P>}</P> <P> </P> <P> </P> <P></SCRIPT> </P>
2. Kód:
<script language="JavaScript" type="text/javascript">
document.write(' Karácsonyig hátralévő idő:<br /><b><div id="winerCountdown"></div></b>');
winerClockCountdown();
function toDateString(strTempString) {
strReturnString = "";
if (strTempString < 10) {
strReturnString += "0";
}
return strReturnString + strTempString.toString();
}
function winerClockCountdown() {
var strEventDate = new Date("December 24, 2006 20:00:00 GMT+2");
// cl = document.clock;
newDate = new Date();
intCount = Math.floor((strEventDate.getTime() - newDate.getTime())/1000);
if(intCount <= 0) {
return;
}
intSeconds = toDateString(intCount % 60);
intCount = Math.floor(intCount / 60);
intMinutes = toDateString(intCount % 60);
intCount = Math.floor(intCount / 60);
intHours = toDateString(intCount % 24);
intCount = Math.floor(intCount / 24);
intDays = intCount;
document.getElementById("winerCountdown").innerHTML =
intDays + " Nap, " +
intHours + " Óra, " +
intMinutes + " Perc, " +
intSeconds + " Másodperc";
setTimeout("winerClockCountdown();", 500);
}
</script> |