• [No000068]document.body.clientHeight 和 document.documentElement.clientHeight 的区别


     document.body.clientWidth ==> BODY对象宽度

    document.body.clientHeight ==> BODY对象高度

    document.documentElement.clientWidth ==> 可见区域宽度

    document.documentElement.clientHeight ==> 可见区域高度

    注意开头<!DOCTYPE ..>的声明,没有该声明时,document.documentElement.clientHeight 始终在Chrome中为1016 px

    测试代码:

    <!DOCTYPE html >
     <head>
      <title> New Document </title>
      <script language="JavaScript">
      function a(){
            document.getElementById("bodyheight").innerText = document.body.clientHeight;
            document.getElementById("documentheight").innerText = document.documentElement.clientHeight;
        }
      </script>
     </head>
    
     <body style= "height: 1000px;">
        <p>
            <a href="javascript:a()">click here</a>
            <br/>
                document.body.clientHeight = <span id="bodyheight"></span> px
            <br/>
                document.documentElement.clientHeight = <span id="documentheight"></span> px
        </p>
     </body>
    </html>
  • 相关阅读:
    Spark 学习笔记
    python-write_text
    python-logging
    耳机能听到自己说话的声音
    AudiosessionSetActive
    error link 2019 waveout
    unknow Unknown type name 'NSString'
    windbg获取打印
    立体声混音设备
    MAC book 无法删除普通用户的解决办法
  • 原文地址:https://www.cnblogs.com/Chary/p/No000068.html
Copyright © 2020-2023  润新知