JS實現刷新iframe的方法
<iframe src="1.htm" name="ifrmname" id="ifrmid"></iframe>
方案一:用iframe的name屬性定位
<input type="button" name="Button" value="Button"
onclick="document.frames('ifrmname').locations.reload()">
或(huò)
<input type="button" name="Button" value="Button"
onclick="document.all.ifrmname.document.locations.reload()">
方案二:用iframe的id屬性定位
<input type="button" name="Button" value="Button"
onclick="ifrmid.window.locations.reload()">
終極(jí)方案:當iframe的src為(wéi)其它網站地址(跨域操作時)
<input type="button" name="Button" value="Button"
onclick="window.open(document.all.ifrmname.src,'ifrmname','')">
關鍵詞:JS,iframe
閱讀(dú)本文後您有什麽感想? 已有(yǒu) 人給出評價!
- 3
- 5
- 6
- 74
- 4
- 2