---
title: "转：JS实现刷新iframe的方法"
author: "llhdf"
date: "2010-02-11T11:10:45Z"
tags: []
categories: ["Web前端"]
slug: "js-iframe"
draft: false
lastmod: "2010-02-11T11:10:45Z"
id: 593125
url: "https://llhdf.iteye.com/blog/593125"
---

<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','')">


<span style="color:red">注意 reload() 是个方法。</span>