zoukankan      html  css  js  c++  java
  • window对象 的一些属性功能

    <!DOCTYPE html>
    <html>

    <head>
    <meta charset="UTF-8">
    <title></title>
    </head>
    <script type="text/javascript">
    (function()
    {
    document.write("浏览器的文档区域大小:");
    document.write(window.innerWidth + "," + window.innerHeight + "<br />");

    document.write("浏览器的窗口大小:");
    document.write(window.outerWidth + "," + window.outerHeight + "<br />");

    document.write("浏览器窗口左上在屏幕中的位置:");
    document.write(window.screenLeft+ "," + window.screenTop + "<br />");
    })();
    </script>

    <body>
    window.innerWidth window.innerHeight 获取文档区的大小
    window.outerWidth window.outerHeight 获取窗口大小
    window.screenLeft window.screenTop 获取浏览器窗口的位置

     可以改变窗口大小后刷新窗口查看数据变化
    </body>

    </html>

    .........................

    浏览器的文档区域大小:1143,735
    浏览器的窗口大小:1159,827
    浏览器窗口左上在屏幕中的位置:60,0
    window.innerWidth window.innerHeight 获取文档区的大小 
    window.outerWidth window.outerHeight 获取窗口大小
    window.screenLeft window.screenTop 获取浏览器窗口的位置

    innerWidth 和innerHeight 属性代表文档区的高和宽,以像素为单位,文档区是指浏览器窗口中可显示网页内容部分,不包括菜单栏,状态栏,地址栏等区域。

    outerWidth 和outerHeight 属性代表整个浏览器窗口的宽和高,以像素为单位。

    screenLeft 和screenTop 属性代表浏览器窗口左上角在屏幕中的坐标。

  • 相关阅读:
    PHP 处理历史数据的伪代码
    PHP 算法之 -- 计算器设计
    PHP
    PHP-设计模式之-中介者模式
    删除更新数据库字段
    MySQL update 链表 (一个表数据当做条件错误时候的转换)
    题解 CF506C Mr. Kitayuta vs. Bamboos
    题解 LOJ2049 「HNOI2016」网络
    题解 CF1349C Orac and Game of Life
    题解 CF1349B Orac and Medians
  • 原文地址:https://www.cnblogs.com/wxhhts/p/7803762.html
Copyright © 2011-2022 走看看