手机版 | 登陆 | 注册 | 留言 | 设首页 | 加收藏
当前位置: 网站首页 > 网站源码 > 文章 当前位置: 网站源码 > 文章

网页直接跳转代码

时间: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'

上一篇:网站源码下载站

下一篇:没有了

联系我们 | 关于我们
冀ICP11345553  |   QQ:1632665886  |  地址:石家庄市学府路48号  |  电话:0310-8391061  |