转:JS实现刷新iframe的方法

强颜欢笑 提交于 2020-01-15 21:41:32

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!