Hola
Al final tendrás que dejar de pagar a ese profesor y pagarme a mi
Código Javascript
:
Ver original<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta name="http-equiv" content="Content-type: text/html; charset=UTF-8"/>
<script type="text/javascript">
function calcular_edad() {
var fecha = null;
var fecha = prompt("Fecha de nacimiento","");
if (fecha == null || fecha == "") {
alert ("Escribe tu fecha de nacimiento");
} else {
var hoy = new Date()
divFecha = fecha.split("/");
var editFecha = new Date(divFecha[2],divFecha[1],divFecha[0])
diferencia = hoy.getTime() - editFecha.getTime();
segundostotales = parseInt(diferencia /1000);
anyos = parseInt(segundostotales/60/60/24/365);
alert(anyos)
}
}
</script>
</head>
<body>
<input type="button" onclick="calcular_edad(); return false;"; value="Fecha" />
</body>
</html>
Suerte