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

104
Views
El resultado de Html y JavaScript parpadea y se apaga inmediatamente cuál podría ser el problema

html

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href=""> </head> <body> <h1> Welcome to Benjamin's bank. Have some Money</h1> <p>Please enter your name, password and the amount you want to withdraw</p> <form action="" method="post"> <input type="text" value="name" id="name"><br> <input type="password" value="password" id="password"><br> <input type="text" value="amount" id="amount"><br> <button onclick="withdraw()">click me</button> </form> <p id="para"></p> <script src="Beginners_bank.js" async defer></script> </body> </html>

JavaScript

 function withdraw(){ var namevar= document.getElementById("name").value; var passwordvar=document.getElementById("password").value; var amountvar=document.getElementById("amount").value; var Amount=3000; var name="Benjamin Anoruo"; var pass="testing123"; var n=Amount-amountvar; if(namevar==name && passwordvar==pass ){ if(amountvar<=Amount){ document.getElementById("para").innerHTML="your withdrawal was successful. your new balance is:"+n; document.body.style.backgroundColor='green'; } } }

Se supone que este código toma el nombre de los usuarios, la contraseña y la cantidad que desean retirar. Cada vez que ingreso cada detalle y hago clic en el botón, solo parpadea la salida y devuelve un formulario vacío. Por favor, ¿cómo puedo solucionar este problema?

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

0

simplemente agregue type="button" a su botón

about 4 years ago · Juan Pablo Isaza Report

0

Tal como señaló @Hyperella, presionar enter hace que la página se actualice, eso es lo que está causando el flash. Para evitar eso, haz lo que te ha enseñado.

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!