获取页面的范围
var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
var clientWidth;
if (window.innerWidth) {
clientWidth = ((Sys.Browser.agent === Sys.Browser.Safari) ? window.innerWidth : Math.min(window.innerWidth, document.documentElement.clientWidth));
} else {
clientWidth = document.documentElement.clientWidth;
}
var clientHeight;
if (window.innerHeight) {
clientHeight = ((Sys.Browser.agent === Sys.Browser.Safari) ? window.innerHeight : Math.min(window.innerHeight, document.documentElement.clientHeight));
} else {
clientHeight = document.documentElement.clientHeight;
}
obj.style.position = 'absolute';
obj.style.zIndex=999;
obj.style.display='block';
obj.style.left = scrollLeft+((clientWidth-a.offsetWidth)/2)+'px';
obj.style.top = scrollTop+((clientHeight-a.offsetHeight)/2)+'px';
var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
var clientWidth;
if (window.innerWidth) {
clientWidth = ((Sys.Browser.agent === Sys.Browser.Safari) ? window.innerWidth : Math.min(window.innerWidth, document.documentElement.clientWidth));
} else {
clientWidth = document.documentElement.clientWidth;
}
var clientHeight;
if (window.innerHeight) {
clientHeight = ((Sys.Browser.agent === Sys.Browser.Safari) ? window.innerHeight : Math.min(window.innerHeight, document.documentElement.clientHeight));
} else {
clientHeight = document.documentElement.clientHeight;
}
obj.style.position = 'absolute';
obj.style.zIndex=999;
obj.style.display='block';
obj.style.left = scrollLeft+((clientWidth-a.offsetWidth)/2)+'px';
obj.style.top = scrollTop+((clientHeight-a.offsetHeight)/2)+'px';
浙公网安备 33010602011771号