Récapitulatif de commande
function putToCenterError(elem) {
var scrOfX = 0, scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
//Netscape compliant
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
//DOM compliant
scrOfY = document.body.scrollTop;
scrOfX = document.body.scrollLeft;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
//IE6 standards compliant mode
scrOfY = document.documentElement.scrollTop;
scrOfX = document.documentElement.scrollLeft;
}
var top = scrOfY + (getWinHeightError()/2);
var left = scrOfX + (getWinWidthError()/2);
elem.style.top = top + "px";
elem.style.left = left + "px";
}
function getWinWidthError() {
var winWidth = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
winWidth = window.innerWidth;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
winWidth = document.documentElement.clientWidth;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
winWidth = document.body.clientWidth;
}
return winWidth;
}
function getWinHeightError() {
var winHeight = 0;
if( typeof( window.innerHeight) == 'number' ) {
//Non-IE
winHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
winHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
winHeight = document.body.clientHeight;
}
return winHeight;
}
window.onscroll = scrollEventError;
window.onresize = scrollEventError;
function scrollEventError() {
if(document.getElementById('errorPageMsgBox'))
putToCenterError(document.getElementById('errorPageMsgBox'));
}
function putToCenterErrorOnlod() {
if(document.getElementById('errorPageMsgBox'))
putToCenterError(document.getElementById('errorPageMsgBox'));
}
putToCenterErrorOnlod();