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 problemCopy code The code is as follows: <br>function imglist(obj) <br>{ <br>var imglist=document.getElementById(obj).getElementsByTagName(' IMG') <br>for (i=0;i<imglist.length;i ) <BR>{ <BR>if(imglist[i].src.indexOf("loading.gif",0)!=-1 ){imglist[i].src="imgage/" i ".gif";} <BR>alert(imglist[i].src) //Test successful<BR>} <BR>} <BR></ script> <br><input onclick="imglist('listimg')" value="test" type="button"><br></p>