跳转页面的几种方法

1、最常用的当然是在a标签里写链接,跳转页面,这个就不用说了

2、使用js的window.loaction跳转页面

<script>
    //使用href属性跳转
location.href ='http://www.baidu.com';
    //使用assign()方法跳转
location.assign('
http://www.baidu.com');
    //使用replace()方法跳转
location.replace('
http://www.baidu.com');
   //只适用于IE
   window.navigate("
http://www.baidu.com"); 
</script>
3、使用Html中<meta>标签来定义页面的元信息

  <!-- 5秒钟后跳转到指定页面 -->
  <meta http-equiv="refresh" content="5;url=http://www.baidu.com"/>
  <!-- 10秒钟后刷新页面,但不跳转 -->
  <meta http-equiv="refresh" content="10">
4、定时器跳转页面

  setTimeout("javascript:location.href='hello.html'", 5000);
5、返回上一页

  window.history.back(-1); 
  window.history.go(-1);
6、打开新窗口
  window.open('http://www.baidu.com')
posted @ 2017-09-10 17:23  柒偌然-初学者  阅读(2234)  评论(0编辑  收藏  举报