JS picture does not finish loading display loading effect

Source: Internet
Author: User

<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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.