分类: Java
2008-11-26 15:26:06
function getPageheight(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else {
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) {
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) {
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) {
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
//arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return windowHeight;
}
//-------------------------------------------------------------------------------------------------------------------
var ffmousexy;
if(!window.event){
document.onmousemove = ffmouse;
}
function ffmouse(ev){
if(!window.event){
ffmousexy=mouseCoords(ev);
}
}
function mouseCoords(ev){
if(ev.pageX || ev.pageY){
return {x:ev.pageX, y:ev.pageY};
}
}
function SelfXY(e){
var yScrolltop;
var xScrollleft;
if (self.pageYOffset || self.pageXOffset) {
yScrolltop = self.pageYOffset;
xScrollleft = self.pageXOffset;
} else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){
yScrolltop = document.documentElement.scrollTop;
xScrollleft = document.documentElement.scrollLeft;
} else if (document.body) {
yScrolltop = document.body.scrollTop;
xScrollleft = document.body.scrollLeft;
}
if(window.event){
arrayPageScroll = new Array(xScrollleft + event.clientX ,yScrolltop + event.clientY);
}else{
arrayPageScroll = new Array(ffmousexy.x , ffmousexy.y);
}
return arrayPageScroll;
}