0

How do i make the in that code visible

https://code.sololearn.com/WWD297Dpu5K7/?ref=app

2nd Dec 2021, 1:41 PM
Favour Chidera
Favour Chidera - avatar
6 odpowiedzi
+ 1
Code is messy, but from what I see you need add img element with src attribute document.write("<span class='width:100%'>" + `<img width="100px" height="100px" src=${image[i]}>` + "</span>" + "\""); And the problem you not getting your images, because the function is never called, although the image urls are not valid, so it won't show up even if you call the function and it will run properly. Add this instead of img element you already have in your html document <button onClick="getContent()" >Call the function</button>
2nd Dec 2021, 2:00 PM
cadbrooke
cadbrooke - avatar
+ 1
You put a variable as a string and forgot to uncomment this out: document.write("<span class='width:100%'>" + "<img width='100px' height='100px' src="+image[i]+">" + "</span>" + "\"");
2nd Dec 2021, 3:54 PM
cadbrooke
cadbrooke - avatar
2nd Dec 2021, 1:46 PM
zexu knub
zexu knub - avatar
0
Check it now https://code.sololearn.com/WWD297Dpu5K7/?ref=app i did some changes but isn't still working
2nd Dec 2021, 2:32 PM
Favour Chidera
Favour Chidera - avatar
0
I'm not sure if it applies here, but there is no link to the JS in the HTML that I could see.
3rd Dec 2021, 12:10 AM
Joseph Fruin
Joseph Fruin - avatar
0
Sololearn playgound internally links the css and javascript tabs. But yes, you should properly link them in your actual code. Perhaps you want to randomly display one of the four items in your contents and image arrays? Except for the broken image link for image[3], maybe you want something like this: https://code.sololearn.com/WosIcQYuOSeX/?ref=app
4th Dec 2021, 2:19 AM
Bob_Li
Bob_Li - avatar