除IE外的浏览器查看窗口大小和位置信息:
//The overall size of the browser window on the desktop
var windowWidth = window.outerwidth;
var windowHeight = window.outerHeight;
//This is the position of the browser window on the desktop
var windowX = window.screenX;
var windowY = window.screenY;
//The size of the viewport in which the HTML document is displayed
//This is the window size minus the menu bars,toolbars,scrollbars,etc.
var viewportWidth = windows.innerWidth;
var viewportHeight = windows.innerHeight;
//These values specify the horizontal and vertical scrollbar positions.
//They are used to convert between document coordinates and window coordinates.
//These values specify what part of the document appears in the upper-left corner of the screen.
var horizontalScroll = window.pageXOffset;
var verticalScroll = window.pageYOffset;