好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

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如何刷新的三种实现方案的详细内容...

  阅读:49次