Get the js code of the src address of img under the div_Basic knowledge
- WBOYOriginal
- 2016-05-16 19:18:171884browse
Purpose: Get the src of img under div
html:
< div id="image2">
.
.
My error code:
initImage();
loadImage();
function initImage() {
for(var i=1;i<13;i ) {
imageId[i]=document.getElementById("image" i);
}
}
function loadImage() {
for(var j=1;j<13;j ){
imageList[j]=imageId[j].getElementsByTagName("img")[0];
if(imageId[j].src ==="images/loading.gif")
imageId[j].src="images/" j ".gif";
else.....
}
}
Code to solve the problem