jQuery动态设置输出窗口的高度

window.onscroll = function () { sc(); };//当系统滚屏时触发
window.onresize = function () { sc(); };//改变窗口大小时触发
window.onload = function () { sc(); };//页面加载时触发

function sc() {
    var h = document.documentElement.clientHeight - 110;//document.documentElement.clientHeight为当前页面高度,110为需要剪掉的固定高度
    $("#result").css({ height: h });//设置的动态高度
    $("#result").css("overflow-y", "scroll");
    $("#result").css("overflow-x", "scroll");
}

posted @ 2011-10-17 11:19  风一样的大叔  阅读(387)  评论(0编辑  收藏  举报