您的位置: 首页> 前端框架> JS实现刷新iframe的方法

JS实现刷新iframe的方法

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

<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滚动条 下一篇:JavaScript下拉菜单实例

相关文章

相关应用

最近更新