1 window.onload=function(){ 2 changeDivHeight(); 3 } 4 //当浏览器窗口大小改变时,设置显示内容的高度 5 window.onresize=function(){ 6 changeDivHeight(); 7 } 8 function changeDivHeight(){ 9 var h = document.documentElement.clientHeight;//获取页面可见高度 10 document.getElementById("div_ov_y").style.height=h-140+"px"; 11 }