miércoles, 22 de marzo de 2017

-1 PARTE

<html>
  <head>
  </head>
  <body>
  <script type="text/javascript">
    var nombre;
    var edad;
    nombre=prompt('Ingrese su nombre:','');
    edad=prompt('Ingrese su edad:','');
    document.write('Hola ');
    document.write(nombre);
    document.write(' asi que tienes ');
    document.write(edad);
    document.write(' años');
function cuantosAnios(dia,mes,anio){
 hoy=new Date();
 nacido=new Date(anio,mes-1,dia);
 tiempo=hoy-nacido;
 unanio=1000*60*60*24*365;
 tienes=parseInt(tiempo/unanio);
 return tienes;
}


alert("El usuario tiene "+cuantosAnios(31,08,1997)+" años");
window.location.href="2Richard.html";

alert("El usuario tiene "+cuantosAnios(31,08,2000)+" años");
window.location.href="3Richard.html";

</script>
  </body>
  </html>



-2 PARTE
  <html>
  <head>
  </head>
  <body>
<body style="background:#FF0000">
  <script type="text/javascript">
var nombre;
    var edad;
    nombre=prompt('Ingrese su nombre:','');
    edad=prompt('Ingrese su edad:','');
    document.write('Hola ');
    document.write(nombre);
    document.write(' asi que tienes ');
    document.write(edad);
    document.write(' años');
 document.write('...............¡ACCESO DENEGADO PAPU!');
    </script>
  </body>
</html>









-3 PARTE

<html>
<head>
</head>
<body>
<script type="text/javascript">
  var nombre;
  nombre=prompt('Ingrese su nombre:','');
  document.write(nombre);
  document.write('<br>');
     function mostrarSeleccionado()
  {
    if (document.getElementById('radio1').checked)
    {
      var num1;
  var num2;
  num1=prompt('ingresa el primer numero:','');
  num2=prompt('ingresa el segundo numero:','');
  var suma=parseInt(num1)+parseInt(num2);

      alert('la suma es: ' +suma);
    }
    if (document.getElementById('radio2').checked)
    {
      var num1;
  var num2;
  num1=prompt('ingresa el primer numero:','');
  num2=prompt('ingresa el segundo numero:','');
  var resta=parseInt(num1)-parseInt(num2);
      alert('la resta es: ' +resta);
    }
  }
</script>
<form>
<input type="radio" id="radio1" name="estudios">suma
<br>
<input type="radio" id="radio2" name="estudios">resta
<br>
<input type="button" value="Mostrar" onClick="mostrarSeleccionado()">
</script>
</body>
</html>









No hay comentarios:

Publicar un comentario