<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元素进行页面刷新的方法:通过name属性、id属性定位以及处理跨域操作时的刷新策略。这些技巧对于前端开发者来说非常实用,能够帮助解决在不同场景下iframe页面更新的问题。
2037

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



