JS页面加载调整Gridview大小

window.onload = adjustHeight;       

function adjustHeight() {
            var divDetail = document.getElementById("divDetail");
            var divVat = document.getElementById("divVat");

            var gvDetail = document.getElementById("gvDetail");
            var gvVAT = document.getElementById("gvVAT");

            if (gvDetail.offsetHeight > 300) {
                divDetail.style.height = "320px";
                divDetail.style.overflow = "scroll";
                gvDetail.style.width = "98%";
            }
            if (gvVAT) {
                if (gvVAT.offsetHeight > 300) {
                    divVat.style.height = "320px";
                    divVat.style.overflow = "scroll";
                }
            }

        }

posted @ 2014-08-15 10:02  画风  阅读(282)  评论(0编辑  收藏  举报