在js中设置页面跳转

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/waley_yang/article/details/50982329

在javascript中设置跳转到指定的页面(other.html)的方法:

方法一:

<script language="javascript" type="text/javascript">

  window.location.href = "other.html";

或者  window.location.assign("other.html");

</script>

  其中window.location对象用于获取当前页面的地址(URL),并把浏览器重定向到新的页面,

    location.href 属性返回当前页面的URL,

    location.assign()方法是加载新的文档。

   


方法二:

<script language="javascript" type="text/javascript">

  top.location="other.html";

</script>


方法三:

<script language="javascript" type="text/javascript">

 self.location="other.html";

</script>



 

猜你喜欢

转载自blog.csdn.net/waley_yang/article/details/50982329
今日推荐