zoukankan      html  css  js  c++  java
  • 窗口中的对象和元素(BOM)

    1.window(代表整个浏览器窗口)

           1) 当前窗口被称之为window,window这个是一个内置的对象

           2) 新开窗口

           3) 通过本地窗口控制新开窗口

              window.status(): 现在已经不再使用window.status()修改浏览器的状态栏了,不需要掌握,IE9中反正我用它设置状态栏不起作用

    (重要)  window.open():   就是弹新窗口的意思       

    window.open("index.jsp");//当我们第一次访问该页面是会 弹出index.jsp窗口
    <script type="text/javascript">
         window.open("index.jsp","newWindow","toolBar=no,left=200,top=100,menuBar=no,width=100,heigth=50,resizable=no");
    1.index.jsp弹出的新窗口显示的页面
    2.newWindow弹出的新窗口的名字
    3.toolBar=no 弹出的新窗口没有工具栏
    4.left=200 距显示屏左边的距离
    5.top=100 距显示屏上边的距离
    6.menuBar=no 没有菜单栏
    7.width=100 弹出窗口的宽度
    8. height=100
    9.resizable=no 不能改变窗口的大小
    </script>
     <body>
       <script type="text/javascript">
        var a= window.open("index.jsp","newWindow","toolBar=no,left=200,top=200,menuBar=no,width=100,height=100,resizable=no");
       </script>
       <input type="button" value="关闭" onclick="a.close();">//控制弹出的窗口关闭的按钮
      </body> 

    2.location

            1)获取或设置现有文档的URL     

            alert(window.location);  //window.location和document.location都是获取地址栏中url地址,效果一样
         // alert(document.location);
    <html>
      <head>
      <title>hello</title>
      </head>
     <script type="text/javascript">
      function go(){
         window.location="index.jsp";  //window.location用于指定要
      }
     </script>
      <body>
       <input type="button" value="转向" onclick="go()">//点击按钮会转向window.location所指的页面
      </body>
    </html>  

    3.history

              1)先前访问过的URL的历史列表

              2)常用方法: back() ,go(number)

    <html>
      <head>
        <base href="<%=basePath%>">
        <script type="text/javascript">
         function goback(){
          history.back();
         }
        </script>
      </head>
      
      <body>
        <input type="button" value="还回" onclick="goback()">//点击还回,回到上一个页面,相当于我们点后退按钮
      </body>
    </html>

    4.document

              1)当前的文档对象

                       document.write():向客户端浏览器输入内容

                       document formName :可以用这个方法得到表单名单

                       document referrer

  • 相关阅读:
    Delphi线程的终止
    Delphi线程简介---Create及其参数、Resume、Suspend
    谈谈Delphi中的类和对象4---类是一种对数据和操作高度的封装机制 && 类是一种代码重用机制
    LeetCode:链表排序
    LeetCode 二叉树的最小深度
    hadoop的集群安装
    java线程池分析和应用
    Java thread中对异常的处理策略
    Thread interrupt方法解析
    如何偷Android的内存-Tricking Android MemoryFile
  • 原文地址:https://www.cnblogs.com/SpringSmallGrass/p/3017787.html
Copyright © 2011-2022 走看看