Agregar reloj a mi web

Cual es el codigo que necesito para agregar el relor en mi sitio web
Respuesta
1
Este codigo es un javascript que añade dia y hora.
-------------------------
<script language="JavaScript">
s_date = new Date();
var weekDay = "";
selectMonth = new Array(12);
selectMonth[0] = "Enero";
selectMonth[1] = "Febrero";
selectMonth[2] = "Marzo";
selectMonth[3] = "ABril";
selectMonth[4] = "Mayo";
selectMonth[5] = "Junio";
selectMonth[6] = "Julio";
selectMonth[7] = "Augosto";
selectMonth[8] = "Septiembre";
selectMonth[9] = "Octubre";
selectMonth[10] = "Noviembre";
selectMonth[11] = "Diciembre";
if(s_date.getDay() == 1){
weekDay = "Lunes";
}
if(s_date.getDay() == 2){
weekDay = "Martes";
}
if(s_date.getDay() == 3){
weekDay = "Miercoles";
}
if(s_date.getDay() == 4){
weekDay = "Jueves";
}
if(s_date.getDay() == 5){
weekDay = "Viernes";
}
if(s_date.getDay() == 6){
weekDay = "Sábado";
}
if(s_date.getDay() == 7){
weekDay = "Domingo";
}
if(s_date.getDay() == 0){
weekDay = "Domingo";
}
var setYear = s_date.getYear();
var BName = navigator.appName;
if(BName == "Netscape"){
var setYear = s_date.getYear() + 1900;
}
document.write(weekDay + ", " + selectMonth[s_date.getMonth()] + " " +
s_date.getDate() + ", " + setYear);
</script>
<div id=Clock align=Right style="font-family Tahoma; font-size: 8; color:Black"> </div>
<script language = "JavaScript">
//Change the color of the font above in the div tag to match your webpage
//colors.
function tick() {
var hours, minutes, seconds, ap;
var intHours, intMinutes, intSeconds;
var today;
today = new Date();
intHours = today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
switch(intHours){
case 0:
intHours = 12;
hours = intHours+":";
ap = "A.M.";
break;
case 12:
hours = intHours+":";
ap = "P.M.";
break;
case 24:
intHours = 12;
hours = intHours + ":";
ap = "A.M.";
break;
default:
if (intHours > 12)
{
intHours = intHours - 12;
hours = intHours + ":";
ap = "P.M.";
break;
}
if(intHours < 12)
{
hours = intHours + ":";
ap = "A.M.";
}
}
if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
timeString = hours+minutes+seconds+ap;
Clock.innerHTML = timeString;
window.setTimeout("tick();", 100);
}
window.onload = tick;
</script>
-------------------------
Pégalo en tu página, y ...

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas