欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

两种在JS中实现页面跳转的方法:原页面跳转与新开标签页

最编程 2024-08-08 11:26:05
...

1 页面跳转(原页面跳转)

(1)a标签实现

<a href="https://blog.****.net/qq_38974638">旭东怪的博客</a>

(2)window.location.href实现

window.location.href="https://blog.****.net/qq_38974638";

2 页面跳转 (打开新标签页)

(1)a标签实现

<a href="https://blog.****.net/qq_38974638" target="_blank">旭东怪的博客</a>

(2)window.open()实现

window.open("https://blog.****.net/qq_38974638");

 

推荐阅读