Este codigo javascript nos permite recordar cuanto tiempo falta para una determinada fecha.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<script type="text/javascript"> var theDay = new Date("dec 25, 2003") //The day has to be in the format Month Day, Year var DayTill //The string that is going to put all numbers together and make sense. function countdown() { var today = new Date() //Create an Date Object that contains today's date. var second = Math.floor((theDay.getTime() - today.getTime())/1000) var minute = Math.floor(second/60) //Devide "second" into 60 to get the minute var hour = Math.floor(minute/60) //Devide "minute" into 60 to get the hour var day = Math.floor(hour/24) //Devide "hour" into 60 to get the day CDay= day //Correct day CHour= hour % 24 //Correct hour, after devide into 24, the remainder deposits here. CMinute= minute % 60 //Correct minute, after devide into 60, the remainder deposits here. CSecond= second % 60 //Correct second, after devide into 60, the remainder deposits here. DayTill = CDay + " dias, " + CHour + " horas, " + CMinute + " minutos and " + CSecond + " segundos " //Rewrite the string to the correct information. document.clock.countdown.value = DayTill //Make the particular form chart become "Daytill" var counter = setTimeout("countdown()", 1000) } //--> </SCRIPT> <BODY onLoad = "countdown()"> <FORM NAME = "clock"> Me faltan ... <INPUT TYPE="TEXT" NAME= "countdown" SIZE= "45">, para el 12 de Julio de 2004. </FORM> |