/**
* Create a covering layer
* Id: the id of the covering layer. If it is null, an id is automatically generated.
* CssObj: Specifies the style object of the covering layer. It can also be a class name.
* Opacity: a decimal point between 0 and 1, indicating transparency. The smaller the number, the higher the transparency.
*/
Function Lock (id, cssObj, opacity ){
Lock. num = Lock. num | 1;
Lock. num ++;
// The id of the current Hidden Layer
Var lockID = id | 'didlock _ '+ Lock. num;
// Default Style
CssObj = cssObj | {backgroundColor: "black", filter: "alpha (Opacity = 40)", opacity: "0.4", zIndex: "1 "};
If (opacity)
{
CssObj. opacity = opacity;
CssObj. filter = "alpha (Opacity =" + (opacity * 100) + ")";
}
// A short function of getElementById
Var $ = function (id) {document. getElementById (id );};
// If a Dom element with the same name already exists, this function is returned.
If ($ (id ))
{
This. success = false;
This. errorMsg = 'id repeated ';
Return;
}
Var divLock = document. createElement ("div ");
// Obtain the height of the current page
Var getBodyHeight = function ()
{
// For IE
If (document. all)
{
Return Math. max (document. body. scrollHeight, document.documentElement.scrollHeight,document.doc umentElement. clientHeight );
}
Return Math. max (document. body. scrollHeight, document.doc umentElement. scrollHeight );
};
DivLock. id = lockID;
DivLock. style. width = Math.max(document.body.scrollWidth,document.doc umentElement. scrollWidth) + "px"
DivLock. style. height = getBodyHeight () + "px ";
DivLock. style. position = "absolute ";
DivLock. style. top = "0px ";
DivLock. style. left = "0px ";
DivLock. style. display = "none ";
// DivLock. style. verticalAlign = "middle ";
SetClass (divLock, cssObj );
Document. body. appendChild (divLock );
This. div = divLock;
This. removed = false;
This. show = function (){
If (this. removed)
{
Return;
}
This. div. style. display = "block ";
};
This. hidden = function (){
If (this. removed)
{
Return;
}
This. div. style. display = "none ";
};
This. remove = function (){
This. div. parentNode. removeChild (this. div );
This. removed = true;
}
}
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