时间:2022-10-11 点击: 次 来源:网络 作者:佚名 - 小 + 大
整理一下JavaScript八种跳转方式,欢迎评论补充! 第一种方法: <script> window.location.replace('http://www.mlwl8.cn') </script> 第二种方法:(推荐简介代码少,直接) <script> window.location = 'http://www.mlwl8.cn' </script> 第三种方法: <script> document.location.href = 'http://www.mlwl8.cn' </script> 第四种方法: history对象的go()方法 <a href='javascript:history.go(-1)' rel='返回上一步'>返回上一步</a> history对象的back()方法 <a href='javascript:history.back()' rel='返回上一步'>返回上一步</a> 第五种方法: <script> top.location = 'http://www.mlwl8.cn' </script> 第六种方法: meta方式实现跳转(content = 3 单位是秒) <meta http-equiv=refresh content=3;url="http://www.mlwl8.cn"> 第七种方法: window.navigate('http://www.mlwl8.cn') 第八种方法: self.location = 'http://www.mlwl8.cn' |
上一篇:网站源码下载站
下一篇:没有了