跨浏览器获取位置
var leftX = typeof window.screenLeft == ‘number’ ? window.screenLeft : window.screenX;var topY = typeof window.screenTop == ‘number’ ? window.screenTop : window.screenY;
firefox浏览器不支持screenLeft和scrennTop,但是支持screenX和screenY;ie浏览器支持screenLeft和scrennTop,但是不支持screenX和screenY 跨浏览器获取大小
var width = window.innerWidth;//window.必须有,因为IE不支持var height = window.innerHeight;//如果支持inner的,那么就使用它,//不支持的就是用document对象的方法if (typeof width != ‘number’) {if (document.compatMode == ‘CSS1Compat’) {width = document.documentElement.clientWidth; //标准ieheight = document.documentElement.clientHeight;} else { //非标准iewidth = document.body.clientWidth;height = document.body.clientHeight;}}
,巨龟千岁,却也平淡无奇;昙花瞬间,却能绚丽无比。