点击非超链接跳转页面的方法
这里插入一下a标签跳转页面的方式吧
<a href="index.html"></a>
接下来介绍下非超链接跳转页面吧
window.open('url') //打开新的页面
window.location = 'url' //跳转页面后有后退功能
window.location.replace //跳转后没有后退功能
下来举个栗子吧:以div为例
- 直接在html上操作
<div onclick="window.open('index.html')"></div>
<div onclick="window.location='index.html'"></div>
<div onclick="window.location.replace('index.html')"></div>
- 在js上操作
//<div class='skip'></div>
$(".skip").on({
click:function(){
window.open('index.html');
//or window.location='index.html'
//or window.location.replace('index.html')
}
})