zoukankan      html  css  js  c++  java
  • 打开新的页面

    1.window.open(URL,name,specs);

      URL:打开页面的URL,没有指定URL将打开新的空白窗口

      name:_blank 新窗口打开,默认

      _self 当前页面打开

      name 窗口名称 ......

      specs:一个逗号分隔的项目列表。支持以下值: height=pixels 窗口的高度,最小值为100 width=pixels 窗口的宽度,最小值为100 left=pixels top=pixels ......

    示例 window.open('','','width=200,height=200');

    <button id="btn">新建页面</button>
        <script>
            var btn=document.getElementById('btn');
            btn.onclick=function(){
                window.open('child.html','','width=200,height=200');
            }
        </script>

    2.location对象 包含有关当前页面的URL信息

      href 设置或返回完整的 URL。 ……

    location.href='children.html';

    3.

    location.assign('children.html');

    4.

    location.replace('children.html');

    注意

    第一种方法打开的新页面如果是_self本页面打开的,也可以返回

    2,3种方法打开的页面可以返回

    第四种方法打开的新页面,是直接代替了原来的页面,不能返回;

  • 相关阅读:
    [数学]如何旋转曲线
    19_04_25校内训练[最小割]
    第二类斯特林数总结
    19_04_19校内训练[Game]
    kd-tree题目总结
    [HNOI2019]校园旅行
    LCT模板(无讲解)
    min_25筛题目总结
    Miller Robbin测试模板(无讲解)
    19_04_02校内训练[图染色]
  • 原文地址:https://www.cnblogs.com/SunShineM/p/6056351.html
Copyright © 2011-2022 走看看