<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的id属性定位
<input type="button" name="Button" value="Button"
onclick='ifrmid.location.href = "***.htm";'>
终极方案:当iframe的src为其它网站地址(跨域操作时)
<input type="button"
name="Button" value="Button"
onclick="window.open(document.all.ifrmname.src,'ifrmname','')">
本文介绍了几种使用不同属性定位IFrame并实现页面刷新的方法。包括通过name属性与按钮点击事件结合进行刷新,利用id属性定位并刷新IFrame内容,以及在跨域限制下通过打开新窗口来间接刷新IFrame中的页面。
7035

被折叠的 条评论
为什么被折叠?



