Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

76
Vistas
How to store HTML content within an array for Javascript?

My aim is to have a single web page which changes back and forth between two pieces of code every 60 seconds. I am able to do this with two urls/webpages using content refresh, however, ideally I am trying to include it all in one javascript file.

page1content and page2content indicate where I would want to insert the html code within the array. The HTML code is run within a js filter using Rhapsody Integration engine.

Any thoughts on how I might be able to get html content to switch between the two in a continous loop?

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 Respuestas
Responde la pregunta

0

Try the snippet below:

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>

P.S: Setting the interval to 5 seconds to showcase the functionality more quickly

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda