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 ...
随机推荐
- TZOJ 5101 A Game(区间DP)
描述 Consider the following two-player game played with a sequence of N positive integers (2 <= N & ...
- 426. Convert Binary Search Tree to Sorted Doubly Linked List把bst变成双向链表
[抄题]: Convert a BST to a sorted circular doubly-linked list in-place. Think of the left and right po ...
- [leetcode]57. Insert Interval插入区间
Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessa ...
- 交叉编译bash
1 下载bash版本:[version 4.2.53]地址:http://ftp.gnu.org/gnu/bash/ 2 解压将下载的bash压缩包解压,命令: # mkdir /home/carri ...
- 48-Python 安装pyautogui失败解决办法
转载自:https://www.cnblogs.com/SH170706/p/9809830.html Python 安装pyautogui 在Python中使用PyAutoGui模拟键盘和鼠标操作 ...
- Swift 反射机制,命名空间
1. 知道 Swift 中有命名空间 - 在同一命名空间下,全局共享! - 第三方框架使用 Swift 如果直接拖拽到项目中,从属同一个命名空间,很有可能冲突! ...
- 认识正则RegExp;
1.什么是正则??? 就是一条规则,用于检验字符串的格式,目标就是字符串. *只要是表单提交的数据都是字符串 2.正则的定义??? (1)var reg=new RegExp() (2)var reg ...
- Spring 配置文件中 元素 属性 说明
<beans /> 元素 该元素是根元素.<bean /> 元素的属性 default-init // 是否开启懒加载.默认为 false default-dependency ...
- 设计模式 策略模式2 c++11
根据需求的不同 选择不同的策略算法 之前是保存的各种策略类的指针 这里直接使用 function bind 选择对应的算法 代码 // 005.cpp: 定义控制台应用程序的入口点. // #inc ...
- Authorization Security for Mongodb
To keep security for the mongodb server, we can create an authorized machanism. db.createUser( { use ...