Нужна помощь помощь в отладке кода на javascript
Hi, I wrote the below code to create automatic slideshow . But the slideshow is not happening & only one image is showing all time. Please help <!DOCTYPE html> <html> <head> <title color= "#0101DF">Slide show</title> <meta charset="UTF-8"> <meta name= "content" description="This is what Google will show you"> <link rel="icon" href= "https://qsf.ec.quoracdn.net/-3-images.favicon.ico-26-1285e84414ca1091.ico" /> <script> pictures=["Penguins.jpg","saran.jpg","Tulips.jpg"]; function settime() { setInterval(load,1000); } function load() { for (i=0;i<pictures.length;i++){ document.getElementById("img1" ).src=pictures[i]; //setTimeout(load,1000); } } </script> </head> <center> <body bgcolor="#E6E6FA" onload=settime()> <h1> My Pictures </h1> <img id="img1" style="height:100%;width:100%" /> </body> </center> </html>
Что я уже пробовал:
Hi, I wrote the below code to create automatic slideshow . But the slideshow is not happening & only one image is showing all time. Please help <!DOCTYPE html> <html> <head> <title color= "#0101DF">Slide show</title> <meta charset="UTF-8"> <meta name= "content" description="This is what Google will show you"> <link rel="icon" href= "https://qsf.ec.quoracdn.net/-3-images.favicon.ico-26-1285e84414ca1091.ico" /> <script> pictures=["Penguins.jpg","saran.jpg","Tulips.jpg"]; function settime() { setInterval(load,1000); } function load() { for (i=0;i<pictures.length;i++){ document.getElementById("img1" ).src=pictures[i]; //setTimeout(load,1000); } } </script> </head> <center> <body bgcolor="#E6E6FA" onload=settime()> <h1> My Pictures </h1> <img id="img1" style="height:100%;width:100%" /> </body> </center> </html>