iframe如何刷新一直都被网友所关注,接下来为大家详细介绍下三种:用iframe的name属性定位/id属性定位/当iframe的src为其它网站地址时,感兴趣的朋友可以参考下哈

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