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

108
Vistas
Necesito ayuda para agregar un botón para ejecutar una función en mi JavaScript

Necesito ayuda con mi JavaScript, cuando el usuario hace clic en el botón, quiero pedirle al usuario que ingrese un puntaje (0-100) y luego devolver una calificación basada en ese puntaje (por ejemplo, 100-80 = A, 79-60 = B) ... <30=F) Por cierto, explique cómo y por qué se hace cada paso porque soy bastante tonto, gracias.

 <!DOCTYPE html> <html> <head> <title>Marks to Grade Conversion</title> <style> h1 {font-family:serif; font-size:36px; color:#ff0000; text-align:center} h2 {font-family:sans-serif; font-size:24px; color:#000000; text-align:center} body {background-color:#FFCC00} </style> </head> <body> <h2>Faculty of Computer science</h2><br> <h1>End of year module test results Mark to Grade utility</h1><br><br> <h2>Click the button to enter the Mark and display the Grade</h2><br> <h2><button style="font-size:24px; height:50px; width:300px"; onClick="ConvertMark()"> Click to enter the mark </button></h2><br> <h1 id="display grade here"></h1></b></td>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

bastante básico escriba su función, obtenga entrada, convierta, muestre el resultado

 function ConvertMark(){ let display = document.getElementById('display') let grade = prompt("Enter grade: ") let alpha = ""; if (grade >= 90)alpha = 'A' else if(grade >= 80)alpha = 'B' else if(grade >= 70)alpha = 'C' else if(grade >=60)alpha = 'D' else alpha = 'F' display.innerHTML = alpha }
 h1 {font-family:serif; font-size:36px; color:#ff0000; text-align:center} h2 {font-family:sans-serif; font-size:24px; color:#000000; text-align:center} body {background-color:#FFCC00}
 <h2>Faculty of Computer science</h2><br> <h1>End of year module test results Mark to Grade utility</h1><br><br> <h2>Click the button to enter the Mark and display the Grade</h2><br> <h2><button style="font-size:24px; height:50px; width:300px"; onClick="ConvertMark()"> Click to enter the mark </button></h2><br> <h1 id="display"></h1>

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