The js tool method pops up a mask. If you need it, refer to it.
The Code is as follows:
// Tool method pop-up mask add by dning 2012-11-4
Var maskShow = (function (){
Var mask = null;
Var curr = null;
Var free = false;
Var func = {
Onresize: null,
Onscroll: null
};
Return function (el, fre, Type ){
If (! Mask ){
InitMask ();
}
Free = !! Fre;
If (el = null ){
Show (curr, false );
Show (mask, false );
ShowSelects (true); // for ie6
Curr = null;
If (! Free) for (var s in func ){
Window [s] = func [s];
Func [s] = null;
}
} Else {
If (curr)
Show (curr, false );
Curr = $ (el) [0];
CheckVisib (curr );
RePos ();
Mask. style. zIndex = maskShow. zIndexBack | 15;
Curr. style. zIndex = maskShow. zIndexFore | 20;
Show (curr, true );
Show (mask, true );
ShowSelects (false, el); // for ie6
If (! Free) for (var s in func ){
Func [s] = window [s];
Window [s] = rePos;
}
}
If (Type = 0 ){
Mask. style. width = document. body. clientWidth + 'px ';
Mask. style. height = document. body. clientHeight + 'px ';
If (el) el. style. position = "fixed ";
} Else {
Mask. style. width = "0px ";
Mask. style. height = "0px ";
If (el) el. style. position = "absolute ";
}
};
Function showSelects (B, box ){
If (! Browser. IE6) return;
Var sel = document. getElementsByTagName ('select ');
Var vis = B? 'Notificable': 'ddy ';
For (var I = 0; I <sel. length; I ++ ){
If (B |! ChildOf (sel [I], box) & sel [I]. currentStyle. visibility! = Vis) sel [I]. style. visibility = vis;
}
}
Function childOf (a, B ){
While (a &! = B) a = a. parentNode;
Return a = B;
}
Function initMask (){
/*
Mask = document. createElement ('iframe ');
Mask. src = ': // 0 ';
*/
Mask = document. createElement ('P ');
Mask.style.css Text = 'background-color: {$ c}; border: none; position: absolute; visibility: hidden; opacity: {$ a}; filter: alpha (opacity = {$ })'. replaceWith ({
C: maskShow. bgColor | '#000 ',
A: maskShow. bgAlpha | '0. 5 ',
A: maskShow. bgAlpha? ParseInt (maskShow. bgAlpha * 100): '50'
});
Document. body. appendChild (mask );
MaskShow. mask = mask;
}
Function checkVisib (el ){
Var sty = el. style;
Sty. position = 'absolute ';
Sty. left = '-margin PX ';
Sty. top = '-pixel PX ';
Sty. visibility = 'visable ';
Sty. display = 'block ';
Sty. zIndex = 10;
}
Function rePos (){
If (! Curr) return;
Var ps = $ pageSize ('Doc ');
SetRect (mask, ps );
Var rc = centerPos (ps, curr. offsetWidth, curr. offsetHeight );
If (rc. left <ps. scrollLeft) rc. left = ps. scrollLeft;
If (rc. top <ps. scrollTop) rc. top = ps. scrollTop;
SetRect (curr, rc );
}
Function centerPos (ps, cw, ch ){
Return {
Left: (ps. winWidth-cw)> 1) + ps. scrollLeft + (maskShow. adjustX | 0 ),
Top: (ps. winHeight-ch)> 1) + ps. scrollTop + (maskShow. adjustY | 0)
};
}
Function setRect (el, rect ){
Var sty = el. style;
Sty. left = (rect. left | 0) + 'px ';
Sty. top = (rect. top | 0) + 'px ';
If ('width' in rect)
Sty. width = rect. width + 'px ';
If ('height' in rect)
Sty. height = rect. height + 'px ';
}
Function show (el, B ){
If (! El) return;
El. style. visibility = 'visable ';
If (! B ){
El. style. left =-el. offsetWidth-100 + 'px ';
El. style. top =-el. offsetHeight-100 + 'px ';
}
}
})();