`
NicholasBugs
  • 浏览: 50592 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

碰到一个需要根据页面内容调整窗口大小的需求,网上找到个解决方案,收藏

 
阅读更多

function win_onLoad(){
        var width = document.all["tblKsList"].offsetWidth;   
        var height = document.all["tblKsList"].offsetHeight;
        width = eval(width + 50);
        height = eval(height + 50);

        if (width < 500){
            width = 500;
        }else if (width > screen.width){
            width = screen.width;
        }

        if (height < 400){
            height = 400;
         }else if (height > screen.height){
             height = screen.height;
         }
         window.resizeTo(width,height);
    }
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics