Question: Posted below is my javacript code. It is supposed to make a slideshow of 5 images that change every 2 seconds. However, whenever I run
Posted below is my javacript code. It is supposed to make a slideshow of 5 images that change every 2 seconds. However, whenever I run the code on Google Chrome or any other browser, only the first out of 5 pics show up and then it immediately transitions to an image like the screenshot below. This same image then goes on a loop, blinking every 2 seconds as if it is doing what the program is supposed to do, but the images are just not showing. Help me determine the error in my code posted below, please?

This will display a picture slide show
var curImage = 1; function changeAd() { console.log(document.images[0].src); switch (curImage) { case 1: document.images[0].src = "C:\Users\akeemah\Documents\Week 2 Day 3\images\1.png"; curImage = 2; break; case 2: document.images[0].src = "C:\Users\akeemah\Documents\Week 2 Day 3\images\2.png"; curImage = 3; break; case 3: document.images[0].src = "C:\Users\akeemah\Documents\Week 2 Day 3\images\3.jpg"; curImage = 4; break; case 4: document.images[0].src = "C:\Users\akeemah\Documents\Week 2 Day 3\images\4.jpg"; curImage = 5; break; case 5: document.images[0].src = "C:\Users\akeemah\Documents\Week 2 Day 3\images\5.png"; curImage = 1; break; } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
