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

113
Views
¿Cómo visualizo el resultado de un script de temporizador de cuenta regresiva en código HTML?

Estoy tratando de descubrir cómo mostrar el resultado de este script de temporizador que encontré en línea dentro de otro script. Aquí está el script del temporizador que encontré:

 // Set the date we're counting down to var countDownDate = new Date("Jan 5, 2022 15:37:25").getTime(); // Update the count down every 1 second var x = setInterval(function() { // Get today's date and time var now = new Date().getTime(); // Find the distance between now and the count down date var distance = countDownDate - now; // Time calculations for days, hours, minutes and seconds var days = Math.floor(distance / (1000 * 60 * 60 * 24)); var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((distance % (1000 * 60)) / 1000); // Display the result in the element with id="demo" document.getElementById("demo").innerHTML = days + "d " + hours + "h " + minutes + "m " + seconds + "s "; // If the count down is finished, write some text if (distance < 0) { clearInterval(x); document.getElementById("demo").innerHTML = "EXPIRED"; } }, 1000);
 <!-- Display the countdown timer in an element --> <p id="demo"></p>

Quiero poder mostrar el temporizador donde puse "Quiero mostrar el temporizador aquí".

 <div class="flash-infos"> <div class="flash-info"> <font color="white"; font size = 2; ><b>"I want to display the timer here"</b></font> <center> </div> </div>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

La respuesta es:

 <b id="memo"></b>
about 4 years ago · Juan Pablo Isaza Report

0

Muy bien, asumo que estás usando id="demo" en tu etiqueta "p" así como en la etiqueta "fuente". Así que lo primero tiene prioridad. Solo mantén id="demo" aquí:

 <div class="flash-infos"> <div class="flash-info"> <font font size = 2; ><b id="demo"></b></font> <center> </div> </div>

Y elimina cualquier otro id="demo" que hayas usado en otras partes de HTML. Tenga en cuenta que eliminé color="white", no estoy seguro de si se sincroniza con el color de fondo predeterminado. Intente configurar un color diferente si el blanco puede ser el caso.

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!