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

348
Vistas
Ingrese el nombre de usuario y la identificación de correo electrónico y descargue el certificado pdf con el mismo nombre (nombre + identificación de correo electrónico) desde una carpeta

¿Puede corregir el código a continuación para que un usuario ingrese su nombre e identificación de correo electrónico y su certificado PDF con el mismo (nombre e identificación de correo electrónico) se descargue de la carpeta OOEcertificate?

Llamar a una función de JavaScript
 function myFunction() { var downloadUrl = document.getElementById("url").value; document.getElementById("downlod").href = '/ooecertificate' + downloadUrl + '.pdf'; } alert("You are Successfully Called the JavaScript function"); }
 <div> <label>ENTER YOUR REGISTRATION ID:</label> <br> </br> <label>(Your registration id is your firstname+registered email id: for example if your name is SAMMY DIXIT and your registered email id is SAMMY.DIXIT@GMAIL.COM your REGISTRATION ID WILL BE: SAMMYSAMMY.DIXIT@GMAIL.COM </label> <input type="text" name="url" id="url" onkeyup="myFunction()"> <a href="/OOEcertificate" id="downlod" download><span>Download</span></a> </div> </div>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Esta es una demostración a partir de su código que obtendrá el valor del cuadro de entrada #url y usará ese valor para componer la cadena de URL que se usará para navegar el navegador a la descarga de pdf.

Tal comportamiento se obtiene con window.location.href que comenté para que la demo funcione aquí. En su nombre mostrará la url en la consola.

 function downloadPdf(){ //fetch the registrationId from the input#url let registrationId = document.getElementById("url").value; //transform the registrationId string to lower case registrationId = registrationId.trim().toLowerCase(); const pdfUrl = `/ooecertificate/${registrationId}.pdf`; //this is the statement to redirect the browser to the wanted url //now commented because it wouldn't work here on the snippet //window.location.href = pdfUrl; //on its behalf I'm writing the url on console console.log(pdfUrl); }
 label.fieldLabel{ display: block; margin-bottom: 1rem; } label.fieldDescription{ display: block; margin-bottom: 1rem; border: solid 1px gray; padding: 1em; } button{ cursor: pointer; }
 <div> <label class="fieldDescription"> Your registration id is your firstname+registered email id:<br> For example..<br> if your name is SAMMY DIXIT and your registered email id is SAMMY.DIXIT@GMAIL.COM<br> your REGISTRATION ID WILL BE: <b>sammysammy.dixit@gmail.com</b> </label> <label class="fieldLabel">ENTER YOUR REGISTRATION ID:</label> <input type="text" name="url" id="url"> <button onclick="downloadPdf();">Download</button> </div>

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