JS实现刷新iframe的方法

时间:2024-10-03 18:33:02来源:互联网

下面小编就为大家分享一篇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','')">

本站部分内容转载自互联网,如果有网站内容侵犯了您的权益,可直接联系我们删除,感谢支持!