Using Javascript, I've pulled a value from an XML document and I'm trying to generate as many tags as the value I've pulled is. I assume I would go about doing this using a for loop, but when I tried this, it would only display one image.
for(i=0; i<red; i++){
document.getElementById("red").innerHTML = "<img src='slike/red.png'></img>";
}
I'm aware of why this isn't working, but I couldn't find a solution myself, so I'm wondering what Javascript function do I need?
+=instead of just=?+=instead of=(shorthand string concatenation). You could also use DOM manipulation methods, such as.appendChild.DocumentFragmentinstead.