I am trying to dynamically create child elements and add a background image before appending it to the parent node. Everything is working except for the image files actually appearing. When you inspect the element in Mozilla, it reveals that the li elements have all been created and attached, and even contain the "style" attribute. I am certain it is my reference to the image array that I am not calling correctly...can someone please help me figure out how to use the array to reference the new background image?
external js file:
var images = ["a.gif", "b.gif", "c.gif"];
var jgal = document.getElementById("gallery");
for (i=0; i<images.length; i++)
newLi = document.createElement("li");
newLi.id = i;
newLi.style.backgroundImage = images[i];
This is setting an id to an integer. If I remember correctly, ids/names cannot begin with anything but an underscore or a letter, and cannot be just integers. I think there are also rules about special characters, but I'm not recalling it - I avoid using them, anyway.
There could be something else, but fix that, first, and then see if it's still not working.