web页面跳转:当前窗口/新窗口

1、当前窗口打开:


html中的<a href=>方法:

<a href="https://www.baidu.com/"  target="_parent">当前窗口打开</a>

当然,不加target="_parent" 也可以,因为它默认就是当前窗口内打开该链接的。


js中:

window.location.href = "https://www.baidu.com/";



2、新的窗口打开:


html中的<a href=>方法:

<a href="https://www.baidu.com/"  target="_blank">新的窗口打开</a>


js中:

window.open("https://www.baidu.com/");


posted @ 2016-03-23 15:16  Mr.Kay  阅读(1409)  评论(0编辑  收藏  举报