zoukankan      html  css  js  c++  java
  • JavaScript Window 浏览器对象模型

    1.浏览器对象模型(BOM)使JavaScript有能力与浏览器“对话”。

    2.所有浏览器都支持 window 对象。它表示浏览器窗口。

    3.所有 JavaScript 全局对象、函数以及变量均自动成为 window 对象的成员, 全局变量是 window 对象的属性, 全局函数是 window 对象的方法。

    4.HTML DOM 的 document 也是 window 对象的属性之一。

     1 <!DOCTYPE html>
     2 <html>
     3     <head>
     4         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     5     </head>
     6     <body>
     7         <p id = "demo"></p>
     8         <script>
     9             var w = window.innerWidth
    10                     || document.documentElement.clientWidth
    11                     || document.body.clientWidth;
    12             var h = window.innerHeight
    13                     || document.documentElement.clientHeight
    14                     || document.body.clientHeight;
    15             x = document.getElementById("demo");
    16             x.innerHTML = "浏览器内部窗口宽度:" + w + ",高度:" + h + "。";
    17         </script>
    18     </body>
    19 </html>
    View Code

    5. windown.screen对象包含有关用户屏幕的信息。

    6.window.location 对象用于获得当前页面的地址 (URL),并把浏览器重定向到新的页面。

    7.window.history 对象包含浏览器的历史。

  • 相关阅读:
    用例失败重新运行
    pytest启动浏览器,失败用例截图
    解决pycharm问题:module 'pip' has no attribute 'main'
    pytest的HTML
    pytest 的 yield
    pytest的setup和teardown
    pytest的fixture和conftest
    pycharm运行pytest
    简单易用的MongoDB
    快速入门系列--CLR--02多线程
  • 原文地址:https://www.cnblogs.com/slowalker/p/3461070.html
Copyright © 2011-2022 走看看