`

Finding the size of the browser window

阅读更多
function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}



http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
分享到:
评论

相关推荐

    Build Report Tool 3.0.19.rar

    In desktop and mobile builds, the build size reflects the size of the resulting sharedassets0.assets, sharedassets1.assets (and so on) files that are generated. Also counted are the files in the ...

    计算机网络第六版答案

    After finding the vulnerability, the attacker needs to scan for hosts that are vulnerable. The target is basically to compromise a series of systems by exploiting that particular vulnerability. Any ...

    Professional.MFC.with.VC6

    The Size of It All Activation The Edit Menu OLE and the Clipboard Copying and Cutting OLE Objects Links Drag-and-drop Getting Started with Drag-and-drop Take a Drag On the Clipboard ...

    python3.6.5参考手册 chm

    PEP 486: Make the Python Launcher aware of virtual environments PEP 488: Elimination of PYO files PEP 489: Multi-phase extension module initialization Other Language Changes New Modules typing ...

    最完整的Toad For Oracle使用手册

    - **Installation and Administration of Toad**:涵盖了Toad的安装过程与管理选项。 - **Window Privileges and Toad**:解释了窗口权限如何影响Toad的使用。 - **Toad for Oracle, Read-Only**:讨论了只读模式下...

Global site tag (gtag.js) - Google Analytics