// --> // 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