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

72
Views
cómo arreglar mi proyecto de conversión de unidades métricas/imperiales en Javascript

Estoy tratando de construir un proyecto en solitario en javascript. Tengo problemas para mostrar una función cuando se envía una entrada de número.

este es mi código HTML

 <header> <h1>Metric/Imperial unit conversion</h1> <form> <input type="number" name="input" id="input1"> <input type="submit" onclick="meterFeet()"> </form> </header> <main> <h3>Length (Meter/Feet)</h3> <p class="pl" id="p-l1" "></p> </main>

y este es mi codigo javascript

 let miucn = document.getElementById("input1"); function meterFeet() { document.getElementById("p-l1").textContent = miucn + " meters = " + (miucn * 3.281).toFixed(3) + " feet | " + miucn + " feet =" + (miucn / 3.281).toFixed(3) + " meters"; }
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Hice algunas pequeñas correcciones en tu código.

  1. cambiar el tipo de entrada de enviar a botón
  2. poner (document.getElementById("input1").value) dentro de la función
  3. parseInt() el valor de entrada

 function meterFeet() { let miucn = parseInt(document.getElementById("input1").value); document.getElementById("p-l1").textContent = miucn + " meters = " + (miucn * 3.281).toFixed(3) + " feet | " + miucn + " feet =" + (miucn / 3.281).toFixed(3) + " meters"; return false; }
 <header> <h1>Metric/Imperial unit conversion</h1> <form> <input type="number" name="input" id="input1"> <input type="button" onclick="meterFeet()" value="Submit"> </form> </header> <main> <h3>Length (Meter/Feet)</h3> <p class="pl" id="p-l1" "></p> </main>

about 4 years ago · Santiago Gelvez 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!