当前位置:Gxlcms > JavaScript > 页面跳转小结详解

页面跳转小结详解

时间:2021-07-01 10:21:17 帮助过:6人阅读

本文主要和大家分享页面跳转小结详解,希望能帮助大家更好掌握页面跳转知识。

HTML标签

一般形式上可以用<a></a><button></button><input/>

<a href="链接">GO</a>
<button onclick="window.location.href='链接'">GO</button>
<input type="button" value="GO" onclick="location.href='链接'">

JS跳转页面代码

本页跳转

window.location.href = '链接';
window.location = '链接';
location.href = '链接';
location = '链接';
top.location = '链接';

新页跳转

window.open('链接');
open('链接');

或者在HTML标签中添加target="_blank":

<a href="链接" target="_blank">GO</a>

历史跳转

<a href="history.go(-1)">返回上一步</a>
<a href="window.history.back()">返回上一步</a>

相关推荐:

微信小程序页面跳转事件绑定实例详解

Router解决跨模块下的页面跳转

微信小程点击文字实现页面跳转功能的方法

以上就是页面跳转小结详解的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行