<html>
<head>
<title> Fecha actual 2 </title>
</head>
<body>
<script>
var mydate=new Date();
var year=mydate.getYear();
if (year < 1000)
year+=1900;
var day=mydate.getDay();
var month=mydate.getMonth()+1;
if (month<10)
month="0"+month;
var daym=mydate.getDate();
if (daym<10)
daym="0"+daym;
document.write("<small><font color='000000' face='Arial'><b>"+daym+"/"+month+"/"+year+"</b></font></small>")
</script>
</body>
</html>
y este para la hora:
<html>
<head>
<title>
</title>
<script language="JavaScript">
function mueveReloj(){
momentoActual = new Date()
hora = momentoActual.getHours()
minuto = momentoActual.getMinutes()
segundo = momentoActual.getSeconds()
str_segundo = new String (segundo)
if (str_segundo.length == 1)
segundo = "0" + segundo
str_minuto = new String (minuto)
if (str_minuto.length == 1)
minuto = "0" + minuto
str_hora = new String (hora)
if (str_hora.length == 1)
hora = "0" + hora
horaImprimible = hora + " : " + minuto + " : " + segundo
document.form_reloj.reloj.value = horaImprimible
setTimeout("mueveReloj()",1000)
}
</script>
<script language="JavaScript">
function mueveFecha(){
}
</script>
</head>
<body onload="mueveReloj()"; onload="mueveFecha()">
<div align="center">
<form name="form_reloj">
<input type="text" name="reloj" size="24" style="color : Black;text-align : center;" onfocus="window.document.form_reloj.reloj.blur()">
</form>
</div>
</body>
</html>