\r\n\r\nOPTION 2:\r\n\r\n\r\n\r\n","answerCount":1,"upvoteCount":0,"acceptedAnswer":{"@type":"Answer","text":"Tyler M, this should be possible.\nwork with numeric arrays.😄\n\nvar pic = new Array();\npic[0] = (\"img.png\");\npic[1] = (\"img1.png\");\npic[2] = (\"img2.png\");\n\n document.getElementById(\"myImgBox\").innerHTML = pic[0];\n\n\n
","upvoteCount":3},"suggestedAnswer":[]} }
0

can you use an img id in an Array?

OPTION 1: <html> <body> <img id="first" src="anImage.png"> <img id="second" src="anotherImage.png> </body> <script> var images = ["first", "second"] </script> OPTION 2: <html> <body> </body> <script> var images = ["anImage.png", "anotherImage.png"] </script>

23rd Aug 2018, 2:46 PM
Tyler M
Tyler M - avatar
1 Antwort
+ 3
Tyler M, this should be possible. work with numeric arrays.😄 var pic = new Array(); pic[0] = ("img.png"); pic[1] = ("img1.png"); pic[2] = ("img2.png"); document.getElementById("myImgBox").innerHTML = pic[0]; <img id="myImgBox" /> <div id="myImgBox"></div>
23rd Aug 2018, 3:42 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar