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 ...
随机推荐
- Codeforces Round #500 (Div. 2) [based on EJOI]
Codeforces Round #500 (Div. 2) [based on EJOI] https://codeforces.com/contest/1013 A #include<bit ...
- sql注入case
or 1=1or 1=1--or 1=1#or 1=1/*admin' --admin' #admin'/*admin' or '1'='1admin' or '1'='1'--admin' or ' ...
- tiny4412 --uboot移植(2) 点灯
开发环境:win10 64位 + VMware12 + Ubuntu14.04 32位 工具链:linaro提供的gcc-linaro-6.1.1-2016.08-x86_64_arm-linux-g ...
- django 在centos 7 下 指定ip地址和端口 报错问题
windows environment: python manage.py runserver host:port centos environment: python manage.py runse ...
- vba统计电脑计算机名和登陆的用户名
Public Sub GetIPT() gipt = Trim(InputBox("请输入所在组,只需输入前面的字母代码即可 A- groupA B-groupB C-groupC D-gr ...
- PHP开发——数据类型
概述 l 变量就是一个容器,变量本身并没有类型,变量的类型解决值的类型. l PHP和JS都属于弱类型语言,变量在运行过程中,类型是可以变的.但是,Java不可以. l 标量(基本)数据类型:字 ...
- jquery.validate.js的简单示例
一.官方资料 官网 github 二.html <!DOCTYPE html> <html> <head> <meta charset="utf-8 ...
- ES之五:ElasticSearch聚合
前言 说完了ES的索引与检索,接着再介绍一个ES高级功能API – 聚合(Aggregations),聚合功能为ES注入了统计分析的血统,使用户在面对大数据提取统计指标时变得游刃有余.同样的工作,你在 ...
- Zookeeper Client基础操作和Java调用
## Zookeeper > Zookeeper目前用来做数据同步,再各个服务之前同步关键信息 i.客户端操作 1. 创建 create [-s] [-e] path data acl -s 为 ...
- HTML语言
复习: 1.Web项目的部署结构 静态Web技术(客户端技术):提供的内容任何人在任何时间访问都是一样的 HTML/CSS/JS/Flash.... 动态Web技术(服务器端技术):提供的内容不同人 ...