`
djjchobits
  • 浏览: 57094 次
  • 性别: Icon_minigender_1
  • 来自: 廊坊
社区版块
存档分类
最新评论

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','')">

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics