zoukankan      html  css  js  c++  java
  • window.screen

    window.screen.availWidth 返回当前屏幕宽度(空白空间)
    window.screen.availHeight 返回当前屏幕高度(空白空间)      (1160像素,少了40像素???
    window.screen.width 返回当前屏幕宽度(分辨率值)                   $(window).width()为浏览器窗口的宽度
    window.screen.height 返回当前屏幕高度(分辨率值)
    window.document.body.offsetWidth; 返回当前网页宽度  (网页的宽度为1904,少了16像素????

    window.document.body.offsetHeight; 返回当前网页高度 (若网页中只有一个100像素高的div,此值就为100px)

     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" xml:lang="en">
     3     <head>
     4         <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
     5         <title>window.screen</title>    
     6         <script type="text/javascript" src='js/jquery.js'></script>    
     7         <script type="text/javascript">            
     8             $(function(){
     9                 console.log(window.screen.availWidth);             //1920
    10                 console.log(window.screen.availHeight);             //1160
    11                 console.log(window.screen.width);                 //1920
    12                 console.log(window.screen.height);                 //1200
    13                 console.log(window.document.body.offsetWidth);   //1904
    14                 console.log(window.document.body.offsetHeight);     //500
    15             })
    16         </script>
    17     </head>
    18     <body>        
    19         <div style='100px; height:500px;'></div>
    20     </body>
    21     </html>    
  • 相关阅读:
    [Nowcoder]2020牛客寒假算法基础集训营3
    [Nowcoder]2020牛客寒假算法基础集训营2
    [Nowcoder]2020牛客寒假算法基础集训营1
    [备份]算法模板大集锦
    [东西]neverOpen
    [随笔]ICPC2.0
    [知识点]C++中STL容器之set
    [知识点]数列分块入门1-9
    [知识点]C++中STL容器之vector
    [知识点] 1.3.1 STL简介
  • 原文地址:https://www.cnblogs.com/positive/p/3444928.html
Copyright © 2011-2022 走看看