$(window).resize(function () { //当浏览器大小变化时
alert($(window).height()); //浏览器时下窗口可视区域高度
alert($(document).height()); //浏览器时下窗口文档的高度
alert($(document.body).height()); //浏览器时下窗口文档body的高度
alert($(document.body).outerHeight(true)); //浏览器时下窗口文档body的总高度 包括border padding margin
});
<script>
function adjust(obj){
var div = document.getElementById("pad");
var txt = document.getElementById("txt");
var w = document.body.clientWidth;
var h = document.body.clientHeight;
div.style.width = w/;
div.style.height = h/;
txt.style.width = w/;
txt.style.height = h/;
}
window.onload=function(){
window.onresize = adjust;
adjust();
}
</script>
<body style="margin:0px;height:0px;">
<div id="pad" style="background:red;zoom:1;margin:0px;height:0px;">
<input type="text" id="txt">
</div>
</body>