zoukankan      html  css  js  c++  java
  • 在ASP.NET AJAX中如何判断浏览器及计算其宽高

    在ASP.NET AJAX中如何判断浏览器及计算其宽高
                function getClientBounds()
                
    {
                    
    var clientWidth;
                    
    var clientHeight;
                    
    switch(Sys.Browser.agent) {
                        
    case Sys.Browser.InternetExplorer:
                            clientWidth 
    = document.documentElement.clientWidth;
                            clientHeight 
    = document.documentElement.clientHeight;
                            
    break;
                        
    case Sys.Browser.Safari:
                            clientWidth 
    = window.innerWidth;
                            clientHeight 
    = window.innerHeight;
                            
    break;
                        
    case Sys.Browser.Opera:
                            clientWidth 
    = Math.min(window.innerWidth, document.body.clientWidth);
                            clientHeight 
    = Math.min(window.innerHeight, document.body.clientHeight);
                            
    break;
                        
    default:  // Sys.Browser.Firefox, etc.
                            clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
                            clientHeight 
    = Math.min(window.innerHeight, document.documentElement.clientHeight);
                            
    break;
                    }


                    
    return new Sys.UI.Bounds(00, clientWidth, clientHeight);
                }
  • 相关阅读:
    NS3网络仿真(3): NetAnim
    C++中explicit关键字作用
    JS实现页面跳转 浏览器地址栏保持不变
    凤凰岭一日游
    开发一个软件平台的一些心得体会
    对Jscript操作注册表接口的一点不解
    关于jacob支持BSTR类型的经验总结
    Java 开源博客 —— Solo 0.6.8 正式版发布了!
    Java 开源博客 —— Solo 0.6.8 正式版发布了!
    解决The requested resource is not available的办法
  • 原文地址:https://www.cnblogs.com/zwei1121/p/759308.html
Copyright © 2011-2022 走看看