Home > Web Front-end > JS Tutorial > Get the js code of the src address of img under the div_Basic knowledge

Get the js code of the src address of img under the div_Basic knowledge

WBOY
Release: 2016-05-16 19:18:17
Original
1880 people have browsed it

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
Copy code The code is as follows:





Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template