I have a problem, document.getElementById doesn't work. I get this error: "'null' is not an object (evaluating document.getElementById("alls").innerHTML = pixs
)".
This is my code:
Javascript:
var pixs = "";
for(var ia = 1; ia <= 400 * 500; ia++) {
var r = Math.floor(Math.random() * 257);
var g = Math.floor(Math.random() * 257);
var b = Math.floor(Math.random() * 257);
pixs += "<div class='pix' style='background-color:rgb("+r+","+g+","+b+");'></div>";
}
document.getElementById("alls").innerHTML = pixs;
Body:
<div id="alls"></div>
Can anyone help me?