技术文档
技术文档 > 程序开发 > 详情
JS实现刷新iframe的方法
2020-07-23 14:42 阅读:1122

<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','')">


上一篇 下一篇

首页

分类

订单

购物车

我的