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

79
Views
¿Cómo almacenar contenido HTML dentro de una matriz para Javascript?

Mi objetivo es tener una sola página web que cambie de un lado a otro entre dos piezas de código cada 60 segundos. Puedo hacer esto con dos direcciones URL/páginas web mediante la actualización de contenido; sin embargo, lo ideal sería incluirlo todo en un archivo javascript.

page1content y page2content indican dónde me gustaría insertar el código html dentro de la matriz. El código HTML se ejecuta dentro de un filtro js utilizando el motor de integración Rhapsody.

¿Alguna idea sobre cómo podría obtener contenido html para cambiar entre los dos en un ciclo continuo?

 var next = output.append(input[0]); var html = ""; html = html + "<style>"; html = html + "<span id=\"flicker\"></span>"; html = html + "</style>"; var pageContent = ["page1content", "page2content"]; var count = 0; function changeContent() { $("#flicker").text(pageContent[count]); count < 2 ? count++ : count = 0; } setInterval(changeContent, 60000); XMLData.setText(HTMLBody,'UTF8');
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Pruebe el fragmento a continuación:

 const pageContent = [ ` <p>This is from page 1.</p> <p>This is another paragraph from page 1.</p>`, ` <p>This is from page 2.</p> <p>This is another paragraph from page 2.</p>`]; let count = 0; function changeContent() { $("#flicker").html(pageContent[count]); count++; count %= 2; } setInterval(changeContent, 5000);
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div id="flicker"></div>

PD: establecer el intervalo en 5 segundos para mostrar la funcionalidad más rápidamente

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!