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

308
Views
Cronómetro Javascript que cambia de color cada 10 segundos

Proyecto JS para principiantes, hice que todo funcionara, pero quería jugar con los colores. Buscando que el temporizador cambie de color cada 10 segundos. Pensé que una función básica funcionaría, pero aparentemente no. Sé que estoy haciendo algo mal en alguna parte, pero no puedo resolverlo.

 window.onload = function () { let seconds = 00; let tens = 00; const roundTens = $("#tens"); const roundSeconds = $("#seconds"); const buttonStart = document.getElementById("button-start"); const buttonStop = document.getElementById("button-stop"); const buttonReset = document.getElementById("button-reset"); let Interval; buttonStart.onclick = function () { clearInterval(Interval); Interval = setInterval(startTimer, 10); }; buttonStop.onclick = function () { clearInterval(Interval); }; buttonReset.onclick = function () { clearInterval(Interval); tens = "00"; seconds = "00"; roundTens.text(tens); roundSeconds.text(seconds); }; function colorChange(color1, color2) { if (color1.value === "00" && color2.value === "59") { color1.style.color = "orange"; color2.style.color = "red"; } else if (color1.value === "00" && color2s.value === "00") { color1.style.color = "green"; color2.style.color = "blue"; } } function startTimer() { tens++; if (tens <= 9) { roundTens.text("0" + tens); } if (tens > 9) { roundTens.text(tens); } if (tens > 99) { console.log("seconds"); seconds++; roundSeconds.text("0" + seconds); tens = 0; roundTens.text("0" + tens); } if (seconds > 9) { roundSeconds.text(seconds); } } colorChange(); };
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

startTimer debería llamar a colorChange (actualmente nunca llamado)

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!