JS实现刷新iframe的方法
<iframe src="1.htm" name="ifrmname" id="ifrmid"></iframe>
方案一:用iframe的name属性定位
<input type="button" name="Button" value="Button"
onclick="document.frames('ifrmname').location.reload()">
或
<input type="button" name="Button" value="Button"
onclick="document.all.ifrmname.document.location.reload()">
方案二:用iframe的id属性定位
<input type="button" name="Button" value="Button"
onclick="ifrmid.window.location.reload()">
终极方案:当iframe的src为其它网站地址(跨域操作时)
<input type="button" name="Button" value="Button"
onclick="window.open(document.all.ifrmname.src,'ifrmname','')">
代码如下:<input type=button value=刷新 onclick="history.go(0)">
代码如下:<input type=button value=刷新 onclick="location.reload()">
代码如下:<input type=button value=刷新 onclick="location=location">
代码如下:<input type=button value=刷新 onclick="window.navigate(location)">
代码如下:<input type=button value=刷新 onclick="location.replace(location)">
下面这三种我就不知道该怎么用了,就把代码放在下面吧,哪位要是会的话,可教教大家。
<input type=button value=刷新 onclick="document.execCommand(@#Refresh@#)">
<input type=button value=刷新 onclick="window.open(@#自身的文件@#,@#_self@#)">
<input type=button value=刷新 onClick=document.all.WebBrowser.ExecWB(22,1)>
父页面中存在两个iframe,一个iframe中是一个链接列表,其中的链接指向另一个iframe,用于显示内容。现在当内容内容添加后,在链接列表中添加了一条记录,则需要刷新列表iframe。
在内容iframe的提交js中使用parent.location.reload()将父页面全部刷新,因为另一个iframe没有默认的url,只能通过列表选择,所以只显示了列表iframe的内容。
使用window.parent.frames["列表iframe名字"].location="列表url"即可进刷新列表iframe,而内容iframe在提交后自己的刷新将不受影响。
document.frames("refreshAlarm").location.reload(true); //ok
document.frames("refreshAlarm").document.location.reload(true); //ok
document.frames("refreshAlarm").document.location="/public/alarmsum.asp";//ok
document.getElementByIdx_x("refreshAlarm").src="/public/alarmsum.asp" mce_src="/public/alarmsum.asp"; //ok
document.frames("refreshAlarm").src="/public/alarmsum.asp" mce_src="/public/alarmsum.asp"; //没变化,没动静
注意区别,document.all.refreshAlarm 或 document.frames("refreshAlarm") 得到的是information.asp页面中那个iframe标签,所以对src属性操作有用。
document.frames("refreshAlarm").document得到iframe里面的内容,也就是"/public/alarmsum.asp"中的内容。
这里需要补充说明的是:
采用document.getElementByIdx_x获取后reload是不可以的
但是可以这样
var myiframe = document.getElementByIdx_x("iframe1");
myiframe.src = myiframe.src; //这样同样可以起到刷新的效果。
自动刷新页面
javascript(js)自动刷新页面的实现方法总结2008-04-18 13:24
自动刷新页面的实现方法总结:
1)
<meta http-equiv="refresh"content="10;url=跳转的页面">
10表示间隔10秒刷新一次
2)
<script language=''javascript''>
window.location.reload(true);
</script>
如果是你要刷新某一个iframe就把window给换成frame的名字或ID号
3)
<script language=''javascript''>
window.navigate("本页面url");
</script>
4>
function abc()
{
window.location.href="/blog/window.location.href";
setTimeout("abc()",10000);
}
刷新本页:
Response.Write("<script language=javascript>window.location.href=window.location.href;</script>")
刷新父页:
Response.Write("<script language=javascript>opener.location.href=opener.location.href;</script>")
转到指定页:
Response.Write("<script language=javascript>window.location.href='yourpage.aspx';</script>")
刷新页面实现方式总结(HTML,ASP,JS)
'by aloxy
定时刷新:
1,<script>setTimeout("location.href='url'",2000)</script>
说明:url是要刷新的页面URL地址
2000是等待时间=2秒,
2,<meta name="Refresh" content="n;url">
说明:
n is the number of seconds to wait before loading the specified URL.
url is an absolute URL to be loaded.
n,是等待的时间,以秒为单位
url是要刷新的页面URL地址
3,<%response.redirect url%>
说明:一般用一个url参数或者表单传值判断是否发生某个操作,然后利用response.redirect 刷新。
4,刷新框架页
〈script language=javascript>top.leftFrm.location.reload();parent.frmTop.location.reload();</script〉
弹出窗体后再刷新的问题
Response.Write("<script>window.showModalDialog('../OA/SPCL.aspx',window,'dialogHeight: 300px; dialogWidth: 427px; dialogTop: 200px; dialogLeft: 133px')</script>");//open
Response.Write("<script>document.location=document.location;</script>");
在子窗体页面代码head中加入<base target="_self"/>
刷新的内容加在 if (!IsPostBack) 中
在框架页中右面刷新左面
//刷新框架页左半部分
Response.Write("<script language=javascript>");
Response.Write("parent.left.location.href='PayDetailManage_Left.aspx'");
Response.Write("</script>");
页面定时刷新功能实现
有三种方法:
1,在html中设置:
<title>xxxxx</title>之後加入下面这一行即可!
定时刷新:<META HTTP-EQUIV="Refresh" content="10">
10代表刷新间隔,单位为秒
2.jsp
<% response.setHeader("refresh","1"); %>
每一秒刷新一次
3.使用javascript:
<script language="javascript">
setTimeout("self.location.reload();",1000);
<script>
一秒一次
页面自动跳转:
1,在html中设置:
<title>xxxxx</title>之後加入下面这一行即可!
定时跳转并刷新:<meta http-equiv="refresh" content="20;url=http://自己的URL">,
其中20指隔20秒后跳转到http://自己的URL 页面。
点击按钮提交表单后刷新上级窗口
A窗口打开B窗口
然后在B里面提交数据至C窗口
最后要刷新A窗口
并且关闭B窗口
几个javascript函数
//第一个自动关闭窗口
<script language="javascript">
<!--
function clock(){i=i-1
document.title="本窗口将在"+i+"秒后自动关闭!";
if(i>0)setTimeout("clock();",1000);
else self.close();}
var i=2
clock();
//-->
</script>
//第二个刷新父页面的函数
<script language="javascript">
opener.location.reload();
</script>
//第三个打开窗口
<script language="javascript">
function show(mylink,mytitle,width,height)
{mailwin=window.open(mylink,mytitle,'top=350,left=460,width='+width+',height='+height+',scrollbars=no')}
</script>
JS实现刷新iframe的方法的更多相关文章
- js实现刷新iframe的方法汇总
https://www.jb51.net/article/65013.htm javascript实现刷新iframe的方法的总结,现在假设存在下面这样一个iframe,则刷新该iframe的N种方法 ...
- JS、jQuery 刷新 iframe 的方法
1.JavaScript 刷新 iframe 可以使用以下方法: document.getElementById('some_frame_id').contentWindow.location.rel ...
- JS 中刷新页面的方法
整理了就是这几种,,有些在IE下面是不支持的,慎用... 1,history.go(0) 2,location.reload() 3,location=location 4,location.assi ...
- js禁止刷新的简单方法
//禁止用F5键 这个是键盘按下时触发document.onkeydown = function() { if ( event.keyCode==116) {event.keyCode = 0; e ...
- 【转】js/jquery中刷新iframe方法(兼容主流)
一.js实现刷新两种方式: 1.//方法1 2.document.getElementById('FrameID').contentWindow.location.reload(true); 3.// ...
- js返回上一页并刷新的多种方法
js返回上一页并刷新的几种方法.参考链接:http://www.jbxue.com/article/11230.html <a href="javascript:history.go( ...
- 谷歌、火狐浏览器下实现JS跨域iframe高度自适应的完美解决方法,跨域调用JS不再是难题!
谷歌.火狐浏览器下实现JS跨域iframe高度自适应的解决方法 导读:今天开发的时候遇到个iframe自适应高度的问题,相信大家对这个不陌生,但是一般我们都是在同一个项目使用iframe嵌套页面,这个 ...
- jquery刷新iframe页面的方法(兼容主流)
1,reload 方法,该方法强迫浏览器刷新当前页面.语法:location.reload([bForceGet]) 参数: bForceGet, 可选参数, 默认为 false,从客户端缓存里取 ...
- js和php刷新页面的方法
js中3个最优的刷新页面的方法 window.location.reload(): window.history.go(0): document.execCommand(''Refresh''): p ...
随机推荐
- Javascript中关于数组的认识
昨天在练习js中cookie的时候,知道js中的cookie是一个字符串,这与php中的操作cookie还是有很大的差别的,起初我是以php的思维来学习怎么样使用使用js中的cookie. js中的c ...
- java模拟有验证码的Http登陆
所需资源下载链接(资源免费,重在分享) Tesseract:http://download.csdn.net/detail/chenyangqi/9190667 jai_imageio-1.1-alp ...
- Android四大组件之一:Service(服务)
Service跟Activity也是出于统一级别的组件,且与Activity的最大区别之一主要是没有人机界面,主要是运行在程序的后台(我是这么理解的),帮助文档上说的是运行于进程的主线程中,但是服务并 ...
- Spring里用@RequestParam接受Date类型的url参数
首先引入joda-time包.maven的dependency: <dependency> <groupId>joda-time</groupId> <art ...
- spring4.0源码导入
一个面试,让我知道了自己的不足,一天不进步就是倒退. spring源码导入eclipse 本人的环境 (我导入的是最新的spring 4.0 所以要用jdk1.8) 1 安装git (mac上自带了g ...
- 使用DriverManager获取数据库连接
DriverManager 是驱动的管理类 * 1).可以通过重载的getConnection() 方法获取数据库连接,较为方便 * 2).可以同时管理多个驱动程序,若注册了多个数据库连接,则调用ge ...
- CSS3实现半像素边框
一.思路 普通的1px黑色实线边框: border: 1px solid #000; 半像素边框当然不是简单地把1px改为0.5px(没测试过,可能会被解析成1或者0),border-width的值只 ...
- Winform ListView根据条件定位到指定行
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- nginx反向代理的配置优化
作者:守住每一天 blog:liuyu.blog.51cto.combbs:bbs.linuxtone.orgmsn:liuyubj520#hotmail.comemail:liuyu105#gmai ...
- Oracle varchar2 4000
关于oracle varchar2 官方文档的描述 VARCHAR2 Data Type The VARCHAR2 data type specifies a variable-length char ...