Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

174
Views
¿Cómo redirigir a una URL específica según la contraseña ingresada?

Tengo un botón protegido por contraseña que redirigirá a un usuario a una URL específica cuando se ingrese la contraseña. Funciona bien, pero lo que quiero hacer es, según la contraseña que ingrese el usuario, se lo llevará a una URL que corresponde a lo que ingresó. Digamos que se ingresó 'prueba' en el cuadro, esto redirigirá a los usuarios a 'prueba.com/prueba/prueba.html' pero si el usuario ingresó 'prueba1', será redirigido a 'prueba.com/prueba1/prueba1 .html'. ¿Hay alguna manera de hacer esto? Este es mi código:

 <body> <div id="title"> <span>WELCOME TO</span> <span style="font-size:80px"><br> AiZen</span> </div> <div class="button_container"> <button class="btn" id="HyperLink1" onclick="location.href='home.html';return ValidatePassword()"><span>Enter Now</span></button> </div> <script> function ValidatePassword() { var a = prompt("Enter the password. You know it right?", ""); if (a == "test") { return true } else { alert("No match. Try again.") } return false } </script> </body>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Suponiendo que no tiene acceso a un servidor de aplicaciones back-end, o que no quiere usarlo para esto, puede hacer algo como

 document.getElementById("name").addEventListener("input", function(e) { var val = e.target.value; var form = e.target.closest("form"); //test.com/test1/test1.html form.action = "http://test.com/" + val + "/" + val + ".html"; console.log("action: " + form.action); });
 <form> <input name="name" id="name" /> <input type="submit"> </form>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!