html页面跳转
1、a标签οnclick
<a href="javascript:void(0);" οnclick="js_method()">foo</a>
<a onclick="window.location.href='www.baidu.com'" href="javascript:void(0);">百度一下</a>
2、a标签直接跳转
<a href="http://baidu.com">百度一下</a>
3、直接跳转
window.location.href='index.html';
<button id="load" οnclick="window.location.reload('/html/index.html')">跳转</button>
4、html跳转上一页的方式
window.history.go(-1);或者window.history.back(-1);
<a href="#" onClick="JavaScript:history.back(-1);">返回上一页</a>
<a href="#" onClick="Javascript:history.go(-1);">返回上一页</a>
5、meta标签跳转
<html>
<head>
<title>Content</title>
<meta http-equiv="refresh" content="0;url=/xxx.do?nav=true">
<!-- 经过一段时间转到另外某个页面 content="0;URL=",这里0表示没有延时,直接跳转到后面的URL;把0改成1,则延时1秒后跳转。 -->
</head>
</html>
参考博客:
a标签href属性与onclick事件
a标签添加onclick事件的几种方式