Note that there are some explanatory texts on larger screens.

plurals
  1. POI want to make 3 or more divs show one after the other using Javascript
    primarykey
    data
    text
    <p>I have a section on my site I would like to show some alerts or news on. I want to show the first news for x seconds, then move on to the second news for x seconds and not show the first news anymore, and then unto the third and not show the second .. etc. I am just starting with javascript and the code I was making worked only for one run and then stopped I would like this to go on infinitely or a very high number so that the person can see the news alerts while they are on the page. One after the other. </p> <p>I appreciate any help I can get. Please show me a thorough code because I'm a bit noobish when it comes to this since I started about 2 weeks ago. Thanks!</p> <p>Html: </p> <pre><code> &lt;div id="news1"&gt;Here are some news! 1111&lt;/div&gt; &lt;div id="news2"&gt;Here are some news! 2222&lt;/div&gt; &lt;div id="news3"&gt;Here are some news! 3333&lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>#news1, #news2, #news3{ visibility:hidden; } </code></pre> <p>Javascript:</p> <pre><code> function showIt() { document.getElementById("news1").style.visibility = "visible"; document.getElementById("news3").style.visibility = "hidden"; document.getElementById("news2").style.visibility = "hidden"; } setInterval("showIt()", 3000); function showIt2(){ document.getElementById("news2").style.visibility = "visible"; document.getElementById("news1").style.visibility = "hidden"; document.getElementById("news3").style.visibility = "hidden"; } setInterval("showIt2()", 6000) function showIt2(){ document.getElementById("news2").style.visibility = "visible"; document.getElementById("news1").style.visibility = "hidden"; document.getElementById("news3").style.visibility = "hidden"; setInterval("showIt3()", 3000); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload