Note that there are some explanatory texts on larger screens.

plurals
  1. POJavaScript show Images one by one
    primarykey
    data
    text
    <p>I'm using this code to read array from test.php output, sort it and then show the results like a slide show. </p> <p>there is something wrong at this line because only one of the images is displayed.</p> <pre><code> curimg= (curimg &lt; galleryarray.length) curimg + 1; </code></pre> <p>here is the code:</p> <pre><code>&gt; &lt;script type="text/javascript"&gt; &gt; var curimg=0; &gt; function rotateimages(){ &gt; galleryarray.sort(); &gt; document.getElementById("picsimg").setAttribute("src", "images/"+galleryarray[curimg]); &gt; curimg= (curimg &lt; galleryarray.length); &gt; curimg + 1; &gt; } &gt; &gt; window.onload = function(){ &gt; setInterval("rotateimages()", 2000); &gt; } &gt; &gt; setTimeout(function(){ &gt; window.location.reload(1); &gt; }, 20000); &gt; &gt; &lt;/script&gt; &gt; </code></pre> <p>whats wrong with my code?</p> <p>another problem that i have is that when i load the page for the first time it shows a blank page for 2000 miliseconds. //or whatever value that i've set above.</p> <p>Either the delay is kicking in before the images are loaded or somehow my counting is wrong. how to fix that?</p> <p>this is the output from my php code: </p> <pre><code>var galleryarray = new Array(); galleryarray[0] = "image1.jpg"; galleryarray[1] = "image5.jpg"; galleryarray[2] = "image2.jpg"; galleryarray[3] = "image4.jpg"; galleryarray[4] = "image8.jpg"; galleryarray[5] = "image7.jpg"; galleryarray[6] = "image0.jpg"; galleryarray[7] = "image3.jpg"; galleryarray[8] = "image6.jpg";​ </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    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