div随窗口变化设置高度

window.onscroll = function () { sc(); };
window.onresize = function () { sc(); };
window.onload = function () { sc(); };
function sc() {
    var h = document.documentElement.clientHeight - 80;
    $("#result").css({ height: h });
    $("#result").css("overflow-y", "scroll");
    $("#result").css("overflow-x", "scroll");
}

 

posted @ 2015-04-29 09:26  记忆书签  阅读(465)  评论(0编辑  收藏  举报