Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/09/2009, 21:46
inmortal009
 
Fecha de Ingreso: abril-2009
Mensajes: 75
Antigüedad: 15 años, 10 meses
Puntos: 0
Pregunta Ayuda con Input y funcion (facil de solucionar)

Hola denuevo no se como conectar un iput type="text" a la funcion para que haga un calculo (la funcion calcula cuantos segundos has vivido cuando le das tu año de nacimiento)... El button llama la funcion bien pero no se como decirle que tome el año del input text

Código HTML:
<script type="text/javascript">
function hola() {
var me= getElementsByName("num").value;
d= new Date();
s= d.getFullYear();
tt= s - me;
ens= tt*60*60*24*365
document.write("Has vivido "+ens+" desde "+me")
}
</script>
<input name="num" type="text" size="20"/>
<input type="button" size="20" maxlength="4" onclick="hola()" value="Enviar"/>