Hope someone can help me on this. I really need help.
Can anyone please advise if the following script has any issue whereby it will not be executed properly when it's in a .php page? or, what's the reason that it couldn't work in a .php page?
Any advice is very much appreciated. Thank you so much.
My script is as below:
img1 = new Image(); img1.src = "images/f95ce056343b3dbdb6606096b2123494_ybx7.png";
img2 = new Image(); img2.src = "images/6c714872e4c66a789b21e88fd90f6f03.png";
img3 = new Image(); img3.src = "images/0b2db57ccbd11c6c7a52cc10ad9aa950.png";
img4 = new Image(); img4.src = "images/9f932a67ed4a1c3dd83948b8b7afb052.png";
img5 = new Image(); img5.src = "images/d6085b0ae37acce9f85899a0fb66879f.png";
img6 = new Image(); img6.src = "images/c865d6c72544cb2590ef922c02f1b9eb.png";
img7 = new Image(); img7.src = "images/7b8e0e999dc94fe436e86b4dedfcb8ed.png";
img8 = new Image(); img8.src = "images/c5c25bc26aced3da5e5595734ca1d35d.png";
img9 = new Image(); img9.src = "images/9dd72de17f11cd33f4e9a197ddaaf417.png";
img10 = new Image(); img10.src = "images/cb69f5ea9146d20b6f52bad0e2a5c179.png";
// add as many images as you want
var howManyPics = 10; //set this to the number of pictures you have
var delay = 3; // set this to the number of seconds between each picture
//don't touch anything below here
var pic = 1;
pic = (pic==howManyPics)?1:pic+1;
document.images['img'].src = eval('img'+pic+'.src');
<body onload="setInterval('changePic()', delay*1000);">
<img name="img" src="images/f95ce056343b3dbdb6606096b2123494_ybx7.png">
I quickly used firefox to check if there is any error but none is shown.
The question arised because I inserted the same code at two of my pages - one is at Home page (php page), and another one at Contact page (html page). The rotating image function is working fine at the Contact page, i.e. images are changing automatically every 3 seconds. However, for Home page, only the first image is shown and the rest of the images do not appear at all.
You may go to http://www.cisspr.com to view the rotating image. At both "Home" (on top of the page - the first image of "We perform testing for electromagnetic fields from cellular & broadcast tower) and "Contact" pages (at the bottom of the page).
duplicate in.js loaded, any parameters will be ignored
If you are still having issues between the HTML page and PHP code, keep in mind that when you call the PHP page from a browser, the web server returns HTML code, not PHP. So, you can easily connect to both pages, and in your browser, right click and view source. Check to see what the difference is. Its likely to be a syntax error on the php page.
In addition to what JorgeM said above you can try running the pages in Google Chrome and right click on the slideshow and go down to "Inspect element" it will show you any activity that is going on in the page, then on the bar that shows up go over to console and it will show you all errors on the page.
And as a sidenote there is a really good jquery slideshow tutorial Here, the creator of the page is currently redecorating the page so its a bit wonky at the moment, but you can still read through the tutorial.
Thank you very much to all of you for your help. I followed the advice to remove some problematic plugins at my page which caused the long loading time. The rotating images are now working at my homepage.
Once again, thank you so much and really appreciate all of you for your replies.