<HTML><title>JS picture does not finish loading display loading effect</title><Body><style>img{float: Left;width:200px;Height:200px;margin:0 10px 10px 0}</style><Script>//judging the browservarBrowser=NewObject (); Browser.useragent=window.navigator.userAgent.toLowerCase (); browser.ie=/MSIE/. Test (browser.useragent); Browser.moz=/Gecko/. Test (browser.useragent);//Determine if loading is completefunctionimagess (url,imgid,callback) {varVal=URL;varimg=NewImage ();if(browser.ie) {Img.onreadystatechange=function(){ if(Img.readystate==" Complete"||img.readystate=="Loaded") {callback (Img,imgid);}} }Else if(Browser.moz) {img.onload=function(){if(Img.complete==true) {callback (Img,imgid);}} } //If an exception occurs because of a network or picture, the picture is displayedImg.onerror=function() {img.src="Http://www.86y.org/images/failed.png"}img.src=Val;}//Show Picturesfunctioncheckimg (obj,imgid) {document.getElementById (imgid). Style.csstext="";d Ocument.getelementbyid (imgid). SRC=obj.src;}//Initialize the picture that needs to be displayed, and specify the location to displaywindow.onload=function(){varimglist=document.getElementById ("ImageList"). getElementsByTagName ('img'); for(i=0; I<Imglist.length;i++) {imglist[i].id="img0"+i; //imglist[i].src= "Http://www.86y.org/images/loading.gif"; Imglist[i].style.csstext="Background:url (http://www.86y.org/images/loading.gif) no-repeat Center Center;"imagess (Imglist[i].getattribute ("Data"), imglist[i].id,checkimg);}}</Script><DivID= "ImageList"> <imgData= "Http://www.smashingapps.com/wp-content/uploads/2013/05/uikitsforwebmobile17s.jpg" /> <imgData= "Http://www.smashingapps.com/wp-content/uploads/2013/05/uikitsforwebmobile13.jpg" /> <imgData= "Http://www.smashingapps.com/wp-content/uploads/2013/05/uikitsforwebmobile39.jpg" /> <imgData= "Http://www.smashingapps.com/wp-content/uploads/2013/05/uikitsforwebmobile10.jpg" /> <imgData= "Http://www.smashingapps.com/wp-content/uploads/2013/05/uikitsforwebmobile14.jpg" /></Div></Body></HTML>
JS picture does not finish loading display loading effect