Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
¿Cómo puedo redirigir haciendo clic en el botón dos páginas diferentes según la edad?

Si 30-41 años >Botón > ir a un sitio web.......

De lo contrario, entre 42 y 99 años > mismo botón > ir a otro sitio web.

Aquí está mi código: https://drive.google.com/file/d/1iqCo2CuvPP5Sm_olIZFoovXBlsiG0H6o/view?usp=sharing

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

JavaScript está ahí para rescatar.

HTML:

 <button onclick="navigation()">Click</button>

JavaScript

 <script> function navigation(){ var age = 40; // Not sure how you detect age if (age>=30 && age<=41) window.open("http://www.website1.com"); else if (age>=42 && age<=99) window.open("http://www.website2.com"); } </script>
about 4 years ago · Juan Pablo Isaza Denunciar

0

Heres su html con código modificado. ¡Disfrutar! :)

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Add your Age</title> <script src="https://code.jquery.com/jquery-3.6.0.js"></script> <script src="datepicker.js"></script> </head> <body> <select id="dobday"></select> <select id="dobmonth"></select> <select id="dobyear"></select> <button id="buttonOK" style="margin-left: 40px;background:orange;padding: 10px 25px; " >Ok</button> <script> $(document).ready(function() { $.dobPicker({ daySelector: '#dobday', /* Required */ monthSelector: '#dobmonth', /* Required */ yearSelector: '#dobyear', /* Required */ dayDefault: 'Day', /* Optional */ monthDefault: 'Month', /* Optional */ yearDefault: 'Year', /* Optional */ minimumAge: 18, /* Optional */ maximumAge: 99 /* Optional */ }); }); $( "#buttonOK" ).click(function() { const yearDiff = new Date().getFullYear() - $("#dobyear").find(":selected").text(); if( yearDiff > 30 && yearDiff < 41){ window.location.href = "http://stackoverflow.com"; } else if(yearDiff >= 41 && yearDiff < 99){ window.location.href = "http://google.com"; } else{ window.location.href = "http://yahoo.com"; } }); </script> </body> </html>
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda