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

1、当前窗口打开:


html中的方法:

当前窗口打开

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


js中:

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



2、新的窗口打开:


html中的方法:

target="_blank">新的窗口打开


js中:

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


转载于:https://www.cnblogs.com/fifteen718/p/9533963.html

你可能感兴趣的:(web页面跳转:当前窗口/新窗口)