Operation wait effect, covering layer JS

Source: Internet
Author: User

Function closeloading ()
{
VaR loaddiv;
VaR bgdiv;
Showallselect ();
Bgdiv = Document. getelementbyid ("bgdiv ");
Loaddiv = Document. getelementbyid ("loaddiv ");
If (bgdiv)
{
Document. Body. removechild (bgdiv );
}
If (loaddiv ){
Document. Body. removechild (loaddiv );
}
Document. Body. style. cursor = "default ";
}
Function showloading (){
Hideallselect ();
VaR loaddiv;
If (loaddiv = Document. getelementbyid ("loaddiv ")){
Loaddiv. style. Display = "Block ";
} Else {
Loaddiv = Document. createelement ("Div ");
Loaddiv. ID = "loaddiv ";
Loaddiv. style. Position = "absolute ";
Loaddiv. style. zindex = 1000;
Loaddiv. style. Display = "Block ";
Loaddiv. style. Left = 0;
Loaddiv. style. Top = 0;
Loaddiv. style. Border = "1px solid gray"
Loaddiv. style. Background = "# ffffff"
Loaddiv. style. Padding = "5 ";
}

VaR scrolltop = 0;
VaR clienthig = 0;
If(top.document.doc umentelement & top.document.doc umentelement. scrolltop ){
Scrolltop = top.document.doc umentelement. scrolltop;
} Else if (document. Body ){
Scrolltop = top.doc ument. Body. scrolltop;
}

Clienthig = Document. Body. clientheight;

VaR scrollwid = Document. Body. scrollwidth/2-150;
Loaddiv. style. Left = scrollwid + "PX ";
Loaddiv. style. Top = (scrolltop + clienthig/2) + "PX ";

Loaddiv. innerhtml = " Document. Body. style. cursor = "wait ";


VaR swidth, sheight;
Swidth = Document. Body. scrollwidth; // The page width in the browser workspace or the screen. Width // The Screen width
Sheight = Document. Body. scrollheight; // screen height (vertical resolution)


// Background layer (the size is the same as the valid area of the window, that is, when the dialog box is displayed, the background is displayed as radial Transparent gray)
VaR bgobj = Document. createelement ("Div"); // create a div object (background layer) // dynamically create an element. The created Div
// Define the DIV property, that is, equivalent to (but not true, the object property must be defined
// <Div id = "bgdiv" style = "position: absolute; top: 0; Background-color: #777; filter: progid: dximagestransform. microsoft. alpha (style = 3, opacity = 25, finishopacity = 75); opacity: 0.6; left: 0; width: 918px; Height: 768px; Z-index: 10000; "> </div>
Bgobj. setattribute ('id', 'bgdiv ');
Bgobj. style. Position = "absolute ";
Bgobj. style. Top = "0 ";
Bgobj. style. Background = "# ffffff ";
Bgobj. style. Filter = "progid: DXImageTransform. Microsoft. Alpha (style = 3, opacity = 25, finishopacity = 75 ";
Bgobj. style. Opacity = "0.6 ";
Bgobj. style. Left = "0 ";
Bgobj. style. width = swidth + "PX ";
Bgobj. style. Height = sheight + "PX ";
Bgobj. style. zindex = "10000 ";
// Bgobj. innerhtml = "<IFRAME src = 'javascript: false' style = 'position: absolute; visibility: Inherit; top: 0px; left: 0px; width: 100px; Height: 200px; z-index:-1; '> </iframe> ";
// Bgobj. innerhtml + = "filter = 'progid: DXImageTransform. Microsoft. Alpha (style = 0, opacity = 0 )'";
// Bgobj. innerhtml + = "> </iframe> ";
Document. Body. appendchild (bgobj); // Add the DIV object to the body.

Document. Body. appendchild (loaddiv );

}

Function hideallselect ()
{
Objs = Document. getelementsbytagname ("select ");
For (I = 0; I <objs. length; I ++)
{
Objs [I]. style. Display = "NONE ";
}
}

Function showallselect ()
{
Objs = Document. getelementsbytagname ("select ");
For (I = 0; I <objs. length; I ++)
{
Objs [I]. style. Display = "";
}
}

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.