JS实现刷新iframe的方法

上一篇 / 下一篇  2012-03-23 21:21:49 / 个人分类:js技术

用的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"","""")">


  怎样才刷新showModalDialog和showModelessDialog里的内容?


  在showModalDialog和showModelessDialog里是不能按F5刷新的,又不能弹出菜单。这个只能依靠javascript了,以下是相关代码:


  <body nkeydown="if (event.keyCode==116){reload.click()}">


  <a id="reload" href="filename.htm" style="display:none">reload...</a>


  将filename.htm替换成网页的名字然后将它放到你打开的网页里,按F5就可以刷新了,注意,这个要配合<base target="_self">使用,不然你按下F5会  弹出新窗口的。


  var reload = document.getElementById("reload");


  reload.href = new_url; //url


  reload.click();


TAG:

 

评分:0

我来说两句

龙飞

龙飞

追随自己的梦想,永不言弃。

日历

« 2024-04-26  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 71829
  • 日志数: 62
  • 文件数: 1
  • 书签数: 4
  • 建立时间: 2011-01-27
  • 更新时间: 2012-06-16

RSS订阅

Open Toolbar