For a very easy-to-use loading bar, just a person's image Style

Source: Internet
Author: User

// --> // Loading // obtain the height and width of the browser.

VaR _ pageheight = document.doc umentelement. clientheight,

_ Pagewidth = document.doc umentelement. clientwidth;

// Determine whether loading is left or top

VaR _ loadingtop = _ pageheight> 61? (_ Pageheight-61)/2: 0,

_ Loadingleft = _ pagewidth> 215? (_ Pagewidth-215)/2: 0;

// Load the image and the style of the film.

VaR _ loadinghtml = '<Div id = "loadingdiv" style = "position: absolute; left: 0; width: 100%; Height:' + _ pageheight + 'px; top: 0; Background: # e0ecff; opacity: 0.8; filter: alpha (opacity = 80); Z-index: 10000; "> <Div style =" position: absolute; cursor1: wait; left: '+ _ loadingleft + 'px; top:' + _ loadingtop + 'px; width: 84px; Height: 84px; line-Height: 100px; padding-left: 50px; padding-Right: 5px; Background: URL (/waiting.gif) No-repeat scroll 5px 10px; "> </div> ';

// Generate this style

Document. Write (_ loadinghtml );

 

// Window. onload = function (){

// Var loadingmask = Document. getelementbyid ('loadingdiv ');

// Loadingmask. parentnode. removechild (loadingmask );

//};

 

// If the page is loaded

 

Document. onreadystatechange = completeloading;

 

 

// Determine whether the data is loaded

VaR loadingmask = "";

Function completeloading (){

If (document. readystate = "complete "){

Loadingmask = Document. getelementbyid ('loadingdiv ');

Showtimes ();

}

}

Function showtimes (){

Loadingmask. parentnode. removechild (loadingmask );

}

To use this method, you only need to place it in one JS control. The page can call this Js. Firefox and IE are supported, but ifram will not get the height and width.

For a very easy-to-use loading bar, just a person's image Style

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.