JS获取当前窗口的宽和高
window.onload = function(){
document.onclick = function(){
//输出当前窗口的宽
var windowWidth = document.documentElement.clientWidth || document.body.clientWidth;
alert(windowWidth);
//输出当前窗口的高
var windowHeight = document.documentElement.clientHeight || document.body.clientHeight;
alert(windowHeight);
}
}
运行结果: