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

  • 相关阅读:
    Python中的类(上)
    Django REST Framework API Guide 07
    Django REST Framework API Guide 06
    Django REST Framework API Guide 05
    Django REST Framework API Guide 04
    Django REST Framework API Guide 03
    Django REST Framework API Guide 02
    Django REST Framework API Guide 01
    Django 详解 信号Signal
    Django 详解 中间件Middleware
  • 原文地址:https://www.cnblogs.com/SpringSmallGrass/p/3017787.html
Copyright © 2011-2022 走看看