IFrame中惯用的Reload方法

IFrame中常用的Reload方法iframe srctest.htm nameifrmname idifrmname/iframe方案一:用ifra

IFrame中常用的Reload方法
<iframe src="test.htm" name="ifrmname" id="ifrmname"></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="ifrmname.window.location.reload()">




其他方案:当iframe的src为其它网站地址(跨域操作时)


<input type="button" name="Button" value="Button"
onclick="window.open(document.all.ifrmname.src,'ifrmname','')">