嗯 就是下面这样
<!DOCTYPE html>
<head>
<title>adaptive this page size</title>
<script type="text/javascript">
function adpaHeight()
{
var bodyHeight = document.documentElement.clientHeight; //获取当前浏览器宽高
document.getElementById("t1").style.height = (parseInt(bodyHeight)) + 'px'; //设置当前div宽高
}
window.onload = function(){
adpaHeight();
}
window.onresize = function(){
adpaHeight();
}
</script>
<style>
#t1{
background-color:#ee22cc;
}
#t2{
background-color:#ccee11;
height:100px; }
</style>
<body>
<div id="t1">自适应当前浏览器高度</div>
<div id="t2"></div>
</body>
</html>
这个应该没什么兼容问题哒;