Cross-browser javascript to get the position and size of the window
Cross-browser location Retrieval
Var leftX = typeof window. screenLeft = 'number '? Window. screenLeft: window. screenX; var topY = typeof window. screenTop = 'number '? Window. screenTop: window. screenY;
Firefox does not support screenLeft and scrennTop, but supports screenX and screenY. ie supports screenLeft and scrennTop, but does not support screenX and screenY.
Cross-browser size acquisition
Var width = window. innerWidth; // window. required because IE does not support var height = window. innerHeight; // if inner is supported, use it. // The method of document object if (typeof width! = 'Number') {if (document. compatMode = 'css1compat') {width = document.doc umentElement. clientWidth; // standard ie height = document.doc umentElement. clientHeight;} else {// non-standard ie width = document. body. clientWidth; height = document. body. clientHeight ;}}