Chinaunix首页 | 论坛 | 博客
  • 博客访问: 30465459
  • 博文数量: 708
  • 博客积分: 12163
  • 博客等级: 上将
  • 技术积分: 8240
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-04 20:59
文章分类

全部博文(708)

分类: 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;
}

阅读(1406) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~