码迷,mamicode.com
首页 > 其他好文 > 详细

打开新的页面

时间:2016-11-12 13:57:19      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:返回   ace   round   code   document   页面   方法   location   class   

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种方法打开的页面可以返回

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

打开新的页面

标签:返回   ace   round   code   document   页面   方法   location   class   

原文地址:http://www.cnblogs.com/SunShineM/p/6056351.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!