The specific solution is as follows:
The difference of the clientheight,offsetheight,scrollheight properties of Document.body objects under IE and ff.
ClientHeight
Under IE and FF, this property is no different, refers to the browser's viewable area, that is, remove the browser of those toolbar status bar remaining page display space height.
Offsetheight
Under IE, offsetheight is also the height of the viewer's viewable area (including the sideline)
Under FF, offsetheight is the height of the specific content of the page
ScrollHeight
In IE, scrollheight is the height of the content of the page, can be less than clientheight
Under FF, ScrollHeight is the content height of the Web page, but the minimum value is clientheight
Two, the following is a cross-browser to get the height of the current page solution.
Copy Code code as follows:
function GetPageSize ()
{
var body = document.documentelement;
var bodyoffsetwidth = 0;
var bodyoffsetheight = 0;
var bodyscrollwidth = 0;
var bodyscrollheight = 0;
var pagedimensions = [0,0];
Pagedimensions[0]=body.clientheight;
Pagedimensions[1]=body.clientwidth;
Bodyoffsetwidth=body.offsetwidth;
Bodyoffsetheight=body.offsetheight;
Bodyscrollwidth=body.scrollwidth;
Bodyscrollheight=body.scrollheight;
if (Bodyoffsetheight > Pagedimensions[0])
{
Pagedimensions[0]=bodyoffsetheight;
}
if (Bodyoffsetwidth > Pagedimensions[1])
{
Pagedimensions[1]=bodyoffsetwidth;
}
if (Bodyscrollheight > Pagedimensions[0])
{
Pagedimensions[0]=bodyscrollheight;
}
if (Bodyscrollwidth > Pagedimensions[1])
{
Pagedimensions[1]=bodyscrollwidth;
}
return pagedimensions;
}
third, the page must be placed a div, as a mask layer, the following is the mask layer of CSS style.
Copy Code code as follows:
. lockdiv
{
Position:absolute;
left:0;
top:0;
height:0;
width:0;
Border:2 solid red;
Display:none;
Text-align:center;
Background-color: #DBDBDB;
Filter:alpha (opacity=60);
}
in the client, use the following JavaScript to close the entire page with the mask layer.
Copy Code code as follows:
var sandglassspan = 1;
var timehdl;
function Disablepage ()
{
var ctrlsandglass = document.getElementById ("Divsandglass");
if (sandglassspan==0)
{
Window.cleartimeout (TIMEHDL);
CtrlSandglass.style.display = "None";
Document.body.style.cursor = ' auto ';
Sandglassspan = 1;
}
Else
{
Document.body.style.cursor = ' wait ';
var pagedimensions = GetPageSize ();
ctrlSandglass.style.top = 0;
CtrlSandglass.style.left = 0;
CtrlSandglass.style.height = Pagedimensions[0];
CtrlSandglass.style.width = pagedimensions[1];
CtrlSandglass.style.display = "block";
TIMEHDL = Window.settimeout (disablepage,200);
}
}
if the ASP.net validator control is used on the page, you should use JavaScript as follows.
Copy Code code as follows:
var sandglassspan = 1;
var timehdl;
function Disablepagehavevalidator ()
{
var ctrlsandglass = document.getElementById ("Divsandglass");
if (false = = Page_isvalid)
{
Sandglassspan = 0;
}
if (sandglassspan==0)
{
Window.cleartimeout (TIMEHDL);
CtrlSandglass.style.display = "None";
Document.body.style.cursor = ' auto ';
Sandglassspan = 1;
}
Else
{
Document.body.style.cursor = ' wait ';
CtrlSandglass.style.display = "block";
var pagedimensions = GetPageSize ();
ctrlSandglass.style.top = 0;
CtrlSandglass.style.left = 0;
CtrlSandglass.style.height = Pagedimensions[0];
CtrlSandglass.style.width = pagedimensions[1];
TIMEHDL = Window.settimeout (Disablepagehavevalidator, 200);
}
}
The Disablepage and Disablepagehavevalidator methods can be invoked at the button's onclick event or other timing.