HTML页面自动跳转,windows操作
1) html的实现
<
head
>
<!-- 以下方式只是刷新不跳转到其他页面 -->
<
meta
http-equiv="refresh" content="10">
<!-- 以下方式定时转到其他页面 -->
<
meta
http-equiv="refresh" content="5;url=hello.html">
</
head
>
2) javascript的实现
<script language=
"javascript"
type=
"text/javascript"
>
// 以下方式直接跳转
window.location.href=
'hello.html'
;
// 以下方式定时跳转
setTimeout(
"javascript:location.href='hello.html'"
, 5000);
</script>
<
span
id="totalSecond">5</
span
>
<
script
language="javascript" type="text/javascript">
var second = totalSecond.innerText;
setInterval("redirect()", 1000);
function redirect(){
totalSecond.innerText=--second;
if(second<
0
) location.href='hello.html';
}
</script>
2 location.reload()
3 location=location
4 location.assign(location)
5 document.execCommand('Refresh')
6 window.navigate(location)
7 location.replace(location)
8 document.URL=location.href
这几个都可以刷新
window.location.reload();刷新
window.location.href=window.location.href;刷新
window.close();关闭窗口,不弹出系统提示,直接关闭
window.close()相当于self属性是当前窗口
window.parent.close()是parent属性是当前窗口或框架的框架组
页面实现跳转的九种方法实例:
<html>
< head>
< meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
< title>navigate</title>
< script language="javascript">
setTimeout('window.navigate("top.html");',2000);
setTimeout('window.document.location.href="top.html";',2000);
setTimeout('window.document.location="top.html";',2000);
setTimeout('window.location.href="top.html";',2000);
setTimeout('window.location="top.html";',2000);
setTimeout('document.location.href="top.html";',2000);
setTimeout('document.location="top.html";',2000);
setTimeout('location.href="top.html";',2000);
setTimeout('location.replace("top.html")',2000);
//window对象
//document对象
//location对象
//href属性
//1.window.document.location.href
//2.window.document.location
//3.window.location.href
//4.window.location
//5.document.location.href
//6.document.location
//7.location.href
//8.window.navigate
//9.location.replace
//只要使用location方法,和任意的window对象,location对象,href属性连用,都可以页面的跳转////
< /script>
< /head>
< body>
页面将在2秒后跳转
< /body>
< /html>
解释:
location是个对象,比如本页的document.location和window.location的属性有
location.hostname = community.csdn.net
location.href = http://community.csdn.net/Expert/topic/4033/4033372.xml?temp=2.695864E-02
location.host = community.csdn.net
location.hash =
location.port =
location.pathname = /Expert/topic/4033/4033372.xml
location.search = ?temp=2.695864E-02
location.protocol = http:
可见href是location的属性,类别是string。
HTML页面自动跳转,windows操作的更多相关文章
- HTML实现页面自动跳转的五种方法
下面列了五个例子来详细说明,这几个例子的主要功能是:在5秒后,自动跳转到同目录下的hello.html(根据自己需要自行修改)文件. 1)html的实现 复制代码 代码如下: <head> ...
- JAVA-JSP内置对象之response对象实现页面自动跳转
相关资料:<21天学通Java Web开发> response对象 实现页面自动跳转1.可以通过response对象的addHeader()方法添加一个标题为Refresh的标头,并指定页 ...
- 【前台页面 BUG】回车按钮后,页面自动跳转
点击回车按钮后,页面自动的迅速跳转 原因: 表单隐式提交了. 解决方法: 在方法执行完成后,加上return false; 代码如下: /** * 注册按钮的点击事件 */ $("#regi ...
- 点击<a>标签,禁止页面自动跳到顶部的解决办法
最近在开发一个小web的时候想给一个按钮增加一个弹出dialog功能,但是发现点击按钮后页面总是自动滚动至顶部,这点从用户体验上来讲是极其不爽的,于是开始跳进google大池寻求解决办法.网上的 ...
- HTML5实现页面自动跳转
初学H5,书上说的是<meta http-equiv="refresh" content="5“ url=”./error.html"/>这样可以实 ...
- 关于jsp删除成功,添加成功等之后 页面自动跳转的js写法
因为比较常用,所以写在博客里保存起来,防止以后忘了不会写了: 删除成功,<span id="time" style="background:red"> ...
- html页面自动跳转
<script type="javascrpit"> var url='';//需要跳转的页面 var search = window.location.search; ...
- Bug:播放页面自动跳到首页
一,经历: 1.第一感觉就是从直播间中收到了通知,然后通知得知了用户未登录,直播间便 pop 退出了. 2.由于这个问题是很难复现的,研究了快一个星期后,才发现是直播间底部的我的历史页面中接收到了直播 ...
- tab页面自动跳转原因【在控制ul和li的时候没有细分】
效果图 存储buy的tab跳转js代码 $(function() { $('.tabPanel ul li').click(function(){ $(this).addClass('hit').si ...
随机推荐
- python--linux上如何执行shell命令
1.os.system(command) 参考链接:https://www.jb51.net/article/141877.htm
- 数据库TCPIP协议开了,但还是远程连不上
可能是因为开着防火墙 把防火墙关掉,或者参考下面的链接,在防火墙添加例外 https://zhidao.baidu.com/question/394026326542219285.html
- 二级接口ListableBeanFactory
package org.springframework.beans.factory; import java.lang.annotation.Annotation; import java.util. ...
- kalman滤波(三)---各种滤波的方法汇总+优化的方法
大神解答 一.前提 最一般的状态估计问题,我们会根据系统是否线性,把它们分为线性/非线性系统.同时,对于噪声,根据它们是否为高斯分布,分为高斯/非高斯噪声系统.现实中最常见的,也是最困难的问题,是非线 ...
- ECMAscript,DOM,BOM哪个比较重要
ECMA > DOM > BOM ECMA是JS的核心,语法.变量.对象.各种对象的API.作用域.原型链.闭包.This指向.构造函数等等必须要熟练,有了这些基础你才能去熟练的操作DOM ...
- Sum of Even Numbers After Queries LT985
We have an array A of integers, and an array queries of queries. For the i-th query val = queries[i] ...
- KD-树(下)
来自于https://zhuanlan.zhihu.com/p/23966698 构造 kd 树的例子 上面抽象的定义和算法确实是很不好理解,举一个例子会清楚很多.首先随机在 中随机生成 13 个点作 ...
- linux命令重定向>、>>、 1>、 2>、 1>>、 2>>、 <
重定向命令其实用得不少吧,只是重来都没有仔细看过,这波正好又用到 又有空总结一波. 先看>和>>: 他们俩其实唯一的区别就是>是重定向到一个文件,>>是追加内容到文 ...
- 14. The Realities of Telecommuting 远程办公的现状
14. The Realities of Telecommuting 远程办公的现状 (1) Telecommuting——substituting the computer for the trip ...
- JavaScript基础视频教程总结(031-040章)
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...