zoukankan      html  css  js  c++  java
  • 客户区大小 clientWidth & clientHeight

    加入了浏览器判断

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <head>
     4     <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
     5     <title>111</title>
     6     <style type="text/css">
     7     body{
     8         margin: 0;
     9         padding: 0;
    10     }
    11     </style>
    12 </head>
    13 <body>
    14     <div id="out1" style="200px;height:100px;overflow:scroll; margin:88px;">
    15         <div style="background:#666666;height:150px;"></div>
    16     </div>
    17     <script type="text/javascript" src="test13.js"></script>
    18 </body>
    19 </html>
     1 function getViewport() {
     2     if (document.compatMode == "BackCompat") {
     3         return {
     4              document.body.clientWidth,
     5             height: document.body.clientHeight
     6         };
     7     } else {
     8         return {
     9              document.documentElement.clientWidth,
    10             height: document.documentElement.clientHeight
    11         };
    12     }
    13 }
    14 console.log(getViewport().width);
    15 console.log(getViewport().height);
  • 相关阅读:
    磁盘
    磁盘接口
    Linux help websites
    [SOJ] 1282. Computer games (KMP)
    [SOJ]1753 解码
    hdu 3473 裸的划分树
    hdu 4417 划分树
    hdu 4665 搜索
    hdu 4340 树状DP
    hdu 4005 边连通度与缩点
  • 原文地址:https://www.cnblogs.com/qzsonline/p/2505424.html
Copyright © 2011-2022 走看看