自动刷新页面
来源:互联网 发布:ubuntu下安装新版qq 编辑:程序博客网 时间:2024/05/04 03:55
引用 Javascript刷新页面的几种方法
Javascript刷新页面的几种方法:
1 history.go(0)
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
自动刷新页面的方法:
1.页面自动刷新:把如下代码加入<head>区域中
<meta http-equiv="refresh"content="20">
其中20指每隔20秒刷新一次页面.
2.页面自动跳转:把如下代码加入<head>区域中
<meta http-equiv="refresh"content="20;url=http://www.wyxg.com">
其中20指隔20秒后跳转到http://www.wyxg.com页面
3.页面自动刷新js版
<script language="JavaScript">
function myrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000); //指定1秒刷新一次
</script>
JS刷新框架的脚本语句
//如何刷新包含该框架的页面用
<script language=JavaScript>
parent.location.reload();
</script>
//子窗口刷新父窗口
<script language=JavaScript>
self.opener.location.reload();
</script>
( 或 <ahref="javascript:opener.location.reload()">刷新</a> )
//如何刷新另一个框架的页面用
<script language=JavaScript>
parent.另一FrameID.location.reload();
</script>
如果想关闭窗口时刷新或者想开窗时刷新的话,在<body>中调用以下语句即可。
<bodyonload="opener.location.reload()">开窗时刷新
<bodyonUnload="opener.location.reload()">关闭时刷新
<script language="javascript">
window.opener.document.location.reload()
如果想在刷新时不弹出提示可以用:
window.location.href=window.location.href ;
window.location.reload;
但是window.location.href="要刷新的页面",在ie7中没有问题,在ie6和遨游中就不行,而window.location.reload()就可以,要多注意啦
<js基础>--javascript刷新页面
1.Response.Write("<script language=javascript>parent.left.document.location.reload();</script>");
2.Response.Write("<script>window.top.location='login.aspx';window.close</script>");
3.this.RegisterStartupScript("reload","<script>window.parent.frames('left').location.reload(true);</script>"); 或 this.RegisterStartupScript("reload","<script>window.parent.frames('left').location.href=window.parent.frames('left').location.href;</script>");
javascript页面跳转常用代码
javascript页面跳转常用代码
按钮式:
<INPUT name="pclog" type="button" value="/GO" onClick="location.href='http://www.itpx.net/'">
链接式:
<a href="javascript:history.go(-1)">返回上一步</a>
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>
直接跳转式:
<script>window.location.href='http://www.itpx.net';</script>
开新窗口:
<a href="/javascript:" onClick="window.open('http: //www.itpx.net','','height=500,width=611,scrollbars=yes,status =yes')">培训</a>
javascript的自动页面跳转代码
方法一(动画效果):
<html xmlns ="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv ="Content-Type" content ="text/html; charset=gb2312" />
<title> Loading </title>
</head>
<body>
<form name ="loading" >
<p align ="center" > 正在跳转,请稍后... </p>
<p align ="center" >
<input type ="text" name ="bar" style ="border-style:none; background-color:#D3E8D0; font-weight:bold" />
<input type ="text" name ="percentage" style ="border-style:none; background-color:#FFFFFF; max-width:30px" />
</p>
<p align ="center" >
如果您的浏览器不支持跳转,请点击 <a href ="http://www.515zhao.com" >这里 </a> 手动跳转
</p>
<script language ="javascript" type ="text/javascript" >
var percent= 0 ; //百分比进度,显示在滚动条后面
var element= "||" ; //滚动条单元竖线
var elements= "||" ; //滚动条当前竖线
count(); //开始调用循环
function count(){
percent=percent+ 10 ; //每次百分比加10
elements =elements + element; //滚动条当前竖线增加一个滚动条单元竖线
document.loading.bar.value=elements; //设置窗体loading表单中bar元素的当前值
document.loading.percentage.value=percent+ "%" ; //设置窗体loading表单中percentage元素的当前值
if (percent< 99 ){ //percent小于99则继续循环
setTimeout( "count()" , 500 ); //每500ms进行一次count()
}
else {
window.location = "http://www.515zhao.com" ; //percent达到100时跳转
}
}
</script>
</form>
</body>
</html>
方法二:
<html>
<head>
<meta http-equiv ="refresh" content ="3; url=http://www.515zhao.com" >
</head>
<a href ="http://www.515zhao.com" > 如果您的浏览器没有自动跳转,请点击这里 <a/>
</html>
多谢!解决了
不过,我觉得
<a href="javascript:void(window.open('1.htm','_blank','toolbar=no,scrollbar=no,top=50,left=50,width=100,height=100'));" >Open 1.htm</a>
和
<a href="javascript: var win=window.open
('1.htm','_blank','toolbar=no,scrollbar=no,top=50,left=50,width=100,height=100')" >Open
1.htm</a>
最好。
<a href="#" onclick="window.open('1.htm','_blank','toolbar=no,scrollbar=no,top=50,left=50,width=100,height=100')" >Open 1.htm</a>
<a href="#" onclick="window.open('top.htm','_parent')" >Open dddddhtm</a> //原来页面
点击后,原窗口的联接地址会发生变化,加上了#,感觉不太好:)虽然也能实现功能
js 返回上一页和刷新
1.Javascript 返回上一页history.go(-1),返回两个页面:history.go(-2);
2.history.back().
3.window.history.forward()返回下一页
4.window.history.go(返回第几页,也可以使用访问过的URL)
例:
<ahref="javascript:history.go(-1);">向上一页</a>
response.Write("<scriptlanguage=javascript>")
response.Write("if(!confirm('完成任务?')){history.back();}")
response.Write("</script>")
response.Write("<scriptlanguage=javascript>history.go(-1);</script>")
<ahref="javascript:history.go(-1);">向上一页</a>
页面跳转:onclick="window.location.href='list.aspx'"
P.S.
小技巧(JS引用JS):
<scripttype=text/javascript>
<!--
if(typeof SWFObject == "undefined") {
document.write('<scr'+ 'ipt type="text/javascript"src="/scripts/swfobject-1.5.js"></scr' + 'ipt>');}
//-->
</script>
Javascript刷新页面的几种方法:
1 history.go(0)
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
自动刷新页面的方法:
1.页面自动刷新:把如下代码加入<head>区域中
<metahttp-equiv="refresh" content="20">
其中20指每隔20秒刷新一次页面.
2.页面自动跳转:把如下代码加入<head>区域中
<metahttp-equiv="refresh" content="20;url=http://www.javaeye.com">
其中20指隔20秒后跳转到http://www.javaeye.com页面
3.页面自动刷新js版
<scriptlanguage="JavaScript">
functionmyrefresh()
{
window.location.reload();
}
setTimeout('myrefresh()',1000);//指定1秒刷新一次
</script>
ASP.NET如何输出刷新父窗口脚本语句
1. this.response.write("<script>opener.location.reload();</script>");
2. this.response.write("<script>opener.window.location.href =opener.window.location.href;</script>");
3. Response.Write("<scriptlanguage=javascript>opener.window.navigate(''你要刷新的页.asp'');</script>")
JS刷新框架的脚本语句 www.2cto.com
//如何刷新包含该框架的页面用
<scriptlanguage=JavaScript>
parent.location.reload();
</script>
//子窗口刷新父窗口
<scriptlanguage=JavaScript>
self.opener.location.reload();
</script>
( 或 <ahref="javascript:opener.location.reload()">刷新</a> )
//如何刷新另一个框架的页面用
<scriptlanguage=JavaScript>
parent.另一FrameID.location.reload();
</script>
如果想关闭窗口时刷新或者想开窗时刷新的话,在<body>中调用以下语句即可。
<bodyonload="opener.location.reload()"> 开窗时刷新
<bodyonUnload="opener.location.reload()"> 关闭时刷新
<scriptlanguage="javascript">
window.opener.document.location.reload()
</script>
- 自动刷新页面
- 自动刷新本页面
- 页面自动刷新
- asp页面自动刷新
- 页面自动刷新
- 页面自动刷新
- 页面实现自动刷新
- 页面自动刷新
- 页面自动刷新
- 页面自动刷新代码
- 页面自动刷新
- 页面自动刷新代码
- AJAX 自动刷新页面
- JavaScript自动刷新页面
- js自动刷新页面
- 页面自动刷新
- 页面自动刷新
- 页面自动刷新
- Selenium源码分析之WebDriver
- 【基础练习】【floyd+枚举】codevs1020 孪生蜘蛛题解
- springmvc与 struts2
- IOS ScrollView 内嵌 ScrollView 冲突处理
- SQLyog中文乱码的解决方法
- 自动刷新页面
- C# 类的序列化
- 2015年春招 去哪儿网java研发实习面试
- 任务管理器无法结束进程解决办法
- GDAL源码剖析
- Mac下 lua C模块的编写
- numpy线性代数基础 - Python和MATLAB矩阵处理的不同
- 关于RSA加密的BUG
- 浅谈WebLogic Server的日常管理01