我是靠谱客的博主 勤劳大山,这篇文章主要介绍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','')">

最后

以上就是勤劳大山最近收集整理的关于iframe如何刷新的三种实现方案的全部内容,更多相关iframe如何刷新内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(124)

评论列表共有 0 条评论

立即
投稿
返回
顶部