-
网页自动跳转代码|HTML自动跳转代码 页面自动跳转代码
- 作者:林原隆 分类:电脑技术 发布时间:2023-01-20 09:28:10
有时我们要对网页做跳转,让用户打开该页面后马上或是在一定的时间内跳转到另外一个页面,下面小编分享网页自动跳转代码给大家。 动跳转代码方案一,用 里直接写刷新语句: 如下语句,红色甩部分改成自己的网页地址就好了。蓝色部分为跳转时间 下面是5秒,可以改成自己需要的时间,0表示不等待。 html网页自动跳转代码--西农大网站 测试:html网页自动跳转代码 这里可以写一些文字,在跳转之前可以显示给用户! 自动动跳转代码方案二,用J...
有时我们要对网页做跳转,让用户打开该页面后马上或是在一定的时间内跳转到另外一个页面,下面小编分享网页自动跳转代码给大家。
动跳转代码方案一,用里直接写刷新语句:
如下语句,红色甩部分改成自己的网页地址就好了。蓝色部分为跳转时间 下面是5秒,可以改成自己需要的时间,0表示不等待。
< head>
< meta http-equiv="Content-Language" content="zh-CN">
< meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
< meta http-equiv="refresh" content="5;url=http://www.win7系统吧.com">
< title>html网页自动跳转代码--西农大网站
< /head>
< body>
测试:html网页自动跳转代码
这里可以写一些文字,在跳转之前可以显示给用户!
< /html>
自动动跳转代码方案二,用JavaScript脚本来跳转
2) javascript的实现
// 以下方式直接跳转 window.location.href='hello.html'; // 以下方式定时跳转 setTimeout("javascript:location.href='http://www.win7系统吧.com'", 5000); |
缺点:受到不同浏览器的影响
3) 结合了倒数的javascript实现(IE)
5 var second = totalSecond.innerText; setInterval("redirect()", 1000); function redirect(){ totalSecond.innerText=--second; if(second<0) location.href='http://www.win7系统吧.com'; } |
缺点:firefox不支持(firefox不支持span、p等的innerText属性)
3') 结合了倒数的javascript实现(firefox)
var second = document.getElementById('totalSecond').textContent; setInterval("redirect()", 1000); function redirect() { document.getElementById('totalSecond').textContent = --second; if (second < 0) location.href = 'http://www.win7系统吧.com'; } |
5 if(navigator.appName.indexOf("Explorer") > -1){ document.getElementById('totalSecond').innerText = "my text innerText"; } else{ document.getElementById('totalSecond').textContent = "my text textContent"; } |
5 var second = document.getElementById('totalSecond').textContent; if (navigator.appName.indexOf("Explorer") > -1) { second = document.getElementById('totalSecond').innerText; } else { second = document.getElementById('totalSecond').textContent; } setInterval("redirect()", 1000); function redirect() { if (second < 0) { location.href = 'http://www.win7系统吧.com'; } else { if (navigator.appName.indexOf("Explorer") > -1) { document.getElementById('totalSecond').innerText = second--; } else { document.getElementById('totalSecond').textContent = second--; } } } |
猜您喜欢
- 如何关闭浏览器自动登录功能:百分浏..2024-04-05
- 百度网盘网页版无法启动客户端?这可..2024-04-05
- WPS宏编辑器:揭秘神奇的快速自动化写..2024-04-03
- 浏览器网页打不开错误代码ERR:揭示问..2024-03-27
- 网页显示乱码困扰!解决Edge浏览器疑..2024-03-27
- 搜狗浏览器轻松截屏,图片自动保存设..2024-03-25
相关推荐
- 怎样在word中创建笑脸..2017-07-26
- 期期中彩票购彩教程分享..2017-07-26
- 主板销量排行_主板销量排名2020..2021-06-04
- 怎么在小米手机恢复出厂设置后找回公..2023-10-11
- 笔记本电脑能当显示器吗 笔记本能当..2021-05-14
- BIOS里的csm是什么意思?Launch CSM要开启..2021-10-06