0
How can I make the following to display randomly?
function displayResult() { document.getElementById("choices").rows[0].cells[0].innerHTML="<img src='images/image1.png'/>"; document.getElementById("choices").rows[0].cells[1].innerHTML="<img src='images/image2.png'/>"; document.getElementById("choices").rows[0].cells[2].innerHTML="<img src='images/image3.png'/>"; document.getElementById("choices").rows[0].cells[3].innerHTML="<img src='images/image4.png'/>"; document.getElementById("choices").rows[0].cells[4].innerHTML="<img src='images/image5.png'/>"; }
2 Respuestas
+ 1
SWL I'm new with JS but to easily get help, you have to like your attempted code.
Please link your code.
+ 1
SWL you should create an array with picture numbers, use Math.random() function to randomized the picture image, and splice the item out from the array, to update the cell.
https://code.sololearn.com/W0oipIIzNl8e/?ref=app