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

307
Views
¿Cómo puedo asignar una función a <span>? Para mostrar un número en un lapso

¿Cómo puedo asignar una función a ? Para mostrar un número en un intervalo Captura de pantalla Por favor, dígame, ¿cómo puedo hacer esto? Creado con React Js

 function onlineCount() { Math.floor(100+480*Math.random()); } setInterval(onlineCount, 1000); function HeaderTop() { // const onlineCount = Math.floor(100+480*Math.random()) return ( <div className="header-top"> <div className="header-social"> <div className="header-online"> <div className="online-general-bar"> <div className="online-bar"></div> </div> <span>{() => onlineCount}</span>

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

0

REACCIONAR

 const root = ReactDOM.createRoot( document.getElementById('root') ); function tick() { const element = ( <span>{Math.floor(100 + 480 * Math.random()); setTimeout(function () { onlineCount(); }, 1000);} </span> ); root.render(element); } setInterval(tick, 1000);

JAVASCRIPT PURO

 <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> function onlineCount() { document.getElementById("mySpan").innerText = Math.floor(100 + 480 * Math.random()); setTimeout(function () { onlineCount(); }, 1000); } setTimeout(function () { onlineCount(); }, 1000); </script> </head> <body> <form id="form1"> <div> <span id="mySpan"></span> </div> </form> </body> </html>
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!