打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
js刷新iframe并给iframe中的控件赋值
<iframe name="frm" id="frm"  frameborder=0 height="0" scrolling="no" style="visibility:hidden"></iframe>
需要iframe生效的时候,给frm指定对应的页面则该页面会被调用
eg:
document.getElementById("frm").src="xxxxx.asp?grp="+group+ "&ord="+order;
被调用界面可以通过Request.QueryString("ord")来取值。
另,也可以通过document.frames['frm'].document.getElementById('xxxx').value这种方式给iframe里的控件赋值
eg:
document.frames['frmmedia'].document.getElementById('player').URL = 'D:/test.mp3';
下面是网上路过的资料,瞄一眼~
iframe父窗口刷新子窗口 和子窗口刷新父窗口的js
function reloadleft(){
var leftiframeid = document.getElementById('left');//left为对应iframe的id
leftiframeid.src = "left.html";//ileft.html为frame的页面
}
链接里面加入onclick="reloadleft()"就可以了。
<a href="contact.html" target="main" title="点击查看" onclick="reloadleft()">联系我们</a>
跳转页面的js:window.location.href="new.html"
------------------------
下面是搜集的子窗口刷新父窗口的js
self.opener.location.reload();
window.opener.location.reload(); //关键是这句:刷新父窗口
------------------------
Web开发中适当运用一些弹出子窗口有很多好处,可以节省页面设计代价,获得好的用户体验,在最近项目开发中我遇到了几个父子窗口的问题,现在整理给大家,希望有所帮助.
情景一: 打开某一子窗口, 子窗口中任一按钮点击时候不能弹出新页面,进行完操作后,关闭该子窗口,刷新父窗口.
1: 页面A:父窗口,其中有一个打开子窗口的链接,<a href="#"onclick="open()">页面C</a>
A中有如下js代码:
<script language="JavaScript">
   function open()
    {
      window.showModalDialog("页面B");
    }
</script>
2: 页面B,此为中间页,起过渡作用
B html 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>**</title>
</head>
<frameset rows="0,*">
<frame src="about:blank">
<frame src="页面C">
</frameset><noframes></noframes>
</html>
3:页面C ,要打开的子窗口.
它关闭时候刷新父窗口很简单,只要把A中
<a href="#"onclick="open()">页面C</a> 改为
<a href="页面A"onclick="open()">页面C</a>
2: 页面B,要打开的子窗口,关闭时候触发window.opener.location.reload();window.close();即可刷新父窗口并且关闭子窗口.
情景三:打开某一子窗口,    让用户选择要添加的东东,譬如要添加到文章里的相片选择后关闭子窗口,然后选择的东东出现在父窗口里.
在下图中,我点击"添加照片"链接然后弹出子窗口,在子窗口中选择后点击"添加照片"按钮,子窗口自动关闭,并且父窗口"已添加照片:"下面列出了我选择的照片。
原文地址: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','')">
总结JavaScript(Iframe、window.open、window.showModalDialog)父窗口与子窗口之间的操作
http://www.04js.cn/content.asp?id=1233
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
JS实现刷新iframe的方法
js与php数据交互,无刷新上传及显示,跨域传参
js页面跳转和js对iframe进行页面跳转、刷新
js实现网页防止被iframe框架嵌套及几种location.href的区别
源码
用jquery 刷新 重新加载页面
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服