标签:
1,js获取当前窗口的宽,高
alert(‘可见区域:‘ + window.innerHeight); alert(‘整网页高度‘ + document.documentElement.clientHeight);
2,js获取指定元素的宽,高
//获取指定元素的实际宽,高,带边框 console.log(document.getElementById(‘box‘).offsetHeight); console.log(document.getElementById(‘box‘).offsetWidth); //获取指定元素的可见宽,高,不带边框 console.log(document.getElementById(‘box‘).clientHeight); console.log(document.getElementById(‘box‘).clientheight);
标签:
原文地址:http://www.cnblogs.com/lxdd/p/4201136.html