Red de conocimiento informático - Aprendizaje de programación - Utilice javascript para implementar un reloj. La página muestra la hora actual, incluido el año, mes, día, hora, minuto y segundo, y establece un punto de tiempo en este momento.

Utilice javascript para implementar un reloj. La página muestra la hora actual, incluido el año, mes, día, hora, minuto y segundo, y establece un punto de tiempo en este momento.

lt;htmlgt;

lt;headgt;

lt;titlegt;Timelt;/titlegt;

lt;/headgt;

lt;bodygt;

lt;div?id="time"gt;lt;/divgt;

lt;div?id="alert"gt;lt;/divgt;

lt;/bodygt;

lt;script?type="text/javascript"?charset="utf-8"?async?defergt;

var?{

//obtener la fecha y hora

var fecha = nueva fecha();

var año = fecha.getYear()?1900;

var?mes?=?date.getMonth()?1;

var?day?=?date.getDate();

var? hora?=?date.getHours();

var?min?=?date.getMinutes();

var?sec?=?date.getSeconds(); p>

var?fecha_hora?=?año? ?-"? ?mes? ?"-"? ?día? ?????? ?hora? ?" "? ?seg;

time.innerHTML?=?date_time;

///?cuándo?{

document.getElementById("alert").innerHTML ?= ?" Es hora de mostrar su texto aquí. ";

}

}

}

}

//?establecer?el?