don't worry about what i'm printing to the innerHTML but i was told i could use an variable as an id tag in the "GetElementById" section. I have the tag "1", "2", etc... up to tweleve in my html but i keep getting thrown the error "diceRoller.js:165 Uncaught TypeError: Cannot read property 'innerHTML' of null". am i doing something wrong or will i need to print it all manually?
for (let i=2, j=0; i<14; i++, j++){
let id = i;
if (nTotalRolls>0) {
document.getElementById(i.toString()).innerHTML += "<td>" + i + "</td>" + "<td>" + naVals[j] + "</td>" + "<td>" + naVals[j] / nTotalRolls * 100 + "</td>";
}
Another Problem i'm having is with timers
for (let i=0; i<10; i++) {
document.getElementById("image1").src = "images/dice" + int1 + ".png";
document.getElementById("image2").src = "images/dice" + int2 + ".png";
}
I can't for the life of me figure out how to make this loop sleep for 100 milliseconds every time it loops. I'm supposed to use setTimeout but after a couple hours of trying i can't seem to make it work.
Any help will be appreciated thankyou in advance.