Just add attribute id using, addImage.id="Image"+i;
or setAttribute('id', "Image"+i)
like the following:
for(var i=0;i<Images.length;i++){
var addImage = document.createElement("img");
addImage.className = "cssImages";
addImage.setAttribute('src', Images[i]);
addImage.setAttribute('id', "Image"+i);
IMGdiv.appendChild(addImage);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…